tutorials:use_fluxmodel
Differences
This shows you the differences between two versions of the page.
| Next revision | Previous revision | ||
| tutorials:use_fluxmodel [2024/04/29 14:27] โ created gaetan | tutorials: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 [[: | ||
| ====== Light Model ====== | ====== Light Model ====== | ||
| Line 110: | Line 112: | ||
| </ | </ | ||
| + | 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 '' | ||
| + | |||
| + | See [[: | ||
| + | |||
| + | 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(" | ||
| + | |||
| + | module MyLamp1 extends LightNode { | ||
| + | { | ||
| + | setLight(new SpectralLight(new PhysicalLight( | ||
| + | DISTRIBUTION), | ||
| + | } | ||
| + | } | ||
| + | |||
| + | module MyLamp2 extends LightNode { | ||
| + | { | ||
| + | setLight( | ||
| + | new SpectralLight().( | ||
| + | setPower(10), | ||
| + | setLight(new PhysicalLight(DISTRIBUTION)), | ||
| + | setSpectrum(SPECTRUM))); | ||
| + | } | ||
| + | } | ||
| + | </ | ||
| + | |||
| + | 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 // | ||
| + | |||
| + | |||
| + | ====== 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(" | ||
| + | myShader.setDiffuse(image); | ||
| + | |||
| + | Phong myShader = new Phong(); | ||
| + | myShader.setDiffuse(new RGBColor(0, | ||
| + | // | ||
| + | // | ||
| + | myShader.setDiffuseTransparency(new RGBColor(0.5, | ||
| + | // | ||
| + | // | ||
| + | |||
| + | ChannelSPD MySPD = new ChannelSPD(new IrregularSpectralCurve( | ||
| + | new float[] {400,410, ...., | ||
| + | new float[] {0.1,0, .... ,0.4,0.25} // | ||
| + | )); | ||
| + | Phong myShader = new Phong(); | ||
| + | myShader.setDiffuse(MySPD); | ||
| + | </ | ||
| + | |||
| + | 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
