tutorials:light-modeling-light-shader
Differences
This shows you the differences between two versions of the page.
| Both sides previous revisionPrevious revision | |||
| tutorials:light-modeling-light-shader [2025/06/03 10:04] – MH | tutorials:light-modeling-light-shader [2025/12/10 06:33] (current) – [Phong Shader] MH | ||
|---|---|---|---|
| Line 121: | Line 121: | ||
| Note: In modern Phong shader implementations, | Note: In modern Phong shader implementations, | ||
| + | |||
| + | === Common Shader Definitions === | ||
| + | |||
| + | There are a few common optical properties that one will regularly face. Things like mirror effects, or glass shader are just two of them. Below some examples on how to define these common shaders in GroIMP. | ||
| + | |||
| + | <code java> | ||
| + | // mirror | ||
| + | static Phong mirrorShader = new Phong(); | ||
| + | static { | ||
| + | mirrorShader.setDiffuse(new RGBColor(0.0, | ||
| + | mirrorShader.setSpecular(new Graytone(1)); | ||
| + | mirrorShader.setShininess(new Graytone(1)); | ||
| + | } | ||
| + | |||
| + | |||
| + | // glass | ||
| + | static Phong glassShader = new Phong(); | ||
| + | static { | ||
| + | glassShader.setDiffuse(new RGBColor(1.0, | ||
| + | glassShader.setDiffuseTransparency(new Graytone(0.97)); | ||
| + | glassShader.setSpecular(new Graytone(0.5)); | ||
| + | glassShader.setShininess(new Graytone(0.5)); | ||
| + | } | ||
| + | |||
| + | // semi-transparent | ||
| + | static Phong semiTransparentShader = new Phong(); | ||
| + | static { | ||
| + | semiTransparentShader.setDiffuse(new Graytone(1, | ||
| + | semiTransparentShader.setDiffuseTransparency(new Graytone(0.5)); | ||
| + | } | ||
| + | |||
| + | // total absorber (pure black, reflecting nothing) | ||
| + | static Phong absorberShader = new Phong(); | ||
| + | static { | ||
| + | absorberShader.setDiffuse(new Graytone(0..0)); | ||
| + | } | ||
| + | |||
| + | // red reflector (only reflecting red) | ||
| + | static Phong redShader = new Phong(); | ||
| + | static { | ||
| + | redShader.setDiffuse(new RGBColor(1.0, | ||
| + | } | ||
| + | </ | ||
tutorials/light-modeling-light-shader.txt · Last modified: 2025/12/10 06:33 by MH
