User Tools

Site Tools


tutorials:use_fluxmodel

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Next revision
Previous revision
tutorials:use_fluxmodel [2024/04/29 14:27] โ€“ created gaetantutorials:use_fluxmodel [2024/04/29 14:39] (current) โ€“ gaetan
Line 1: Line 1:
 In this tutorial we will see how to get started with a FluxModel in GroIMP. In this tutorial we will see how to get started with a FluxModel in GroIMP.
 +
 +Go [[:groimp-platform:gpuflux|here]] to see more about how the FluxModel is defined in GroIMP.
  
 ====== Light Model ====== ====== Light Model ======
Line 110: Line 112:
 </code> </code>
  
 +This is :
 +  - importing the required classes
 +  - defining of the physical light distribution
 +  - defining of the spectral power distribution
 +  - defining of a lamp using the specified parameters
 +
 +The light distribution and spectral distribution (i.e. the ''DISTRIBUTION'', ''WAVELENGTHS'' and ''AMPLITUDES'' arrays) can also be provided from ''.ies'' files. 
 +
 +See [[:groimp-platform:input-and-output-in-groimp|here]] for more information on the supported file formats.
 +
 +Then, let's create a parameterizable light node โ€“ using file references for physical and spectral power distribution.
 +
 +<code java>
 +const LightDistributionRef DISTRIBUTION = light("
 +distribution1");
 +const SpectrumRef SPECTRUM = spectrum("equal");
 +
 +module MyLamp1 extends LightNode {
 +{
 +setLight(new SpectralLight(new PhysicalLight(
 +DISTRIBUTION), SPECTRUM, 10)); // 10 W
 +}
 +}
 +
 +module MyLamp2 extends LightNode {
 +{
 +setLight(
 +new SpectralLight().(
 +setPower(10), //[W]
 +setLight(new PhysicalLight(DISTRIBUTION)),
 +setSpectrum(SPECTRUM)));
 +}
 +}
 +</code>
 +
 +This is: 
 +  - Defining a file reference. This file can be included or linked to a project
 +  - Applying a concrete lamp to the reference by:
 +    - using the constructor
 +    - using the set-methods of the //LightNode// class
 +
 +
 +====== Illumination Model ======
 +
 +Definition of a Phong shader by textures, by colours and by a user-defined
 +spectral power distribution.
 +
 +<code java>
 +Phong myShader = new Phong();
 +ImageMap image = new ImageMap();
 +image.setImageAdapter(new FixedImageAdapter(image("leaf").toImageAdapter().getBufferedImage()));
 +myShader.setDiffuse(image);
 +
 +Phong myShader = new Phong();
 +myShader.setDiffuse(new RGBColor(0,1,0));
 +//myShader.setSpecular(new Graytone(0.5));
 +//myShader.setShininess(new Graytone(0.5));
 +myShader.setDiffuseTransparency(new RGBColor(0.5,0,0));
 +//myShader.setAmbient(new Graytone(0.5));
 +//myShader.setEmissive(new Graytone(0.5));
 +
 +ChannelSPD MySPD = new ChannelSPD(new IrregularSpectralCurve(
 +    new float[] {400,410, ....,740,750}, //WAVELENGTHS
 +    new float[] {0.1,0, .... ,0.4,0.25} //AMPLITUDES
 +));
 +Phong myShader = new Phong();
 +myShader.setDiffuse(MySPD);
 +</code>
 +
 +This is:
 +  - Setting an image as texture: Values for reflection depend on the colour of the texture at each pixel of the image. 
 +  - Setting specific properties: At this configuration green will be reflected to 100 % and red will be transmitted to 50 % for the whole surface of the object.
 +  - A user-defined SPD is used to define the diffuse colour.
tutorials/use_fluxmodel.1714393634.txt.gz ยท Last modified: 2024/04/29 14:27 by gaetan