• Advertisement
Sign in to follow this  

Equation for light reflection (diffuse color)

This topic is 899 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

So lets consider we have a light that is white 1,1,1 and red material

now reflected color is red (1,0,0)

 

 

what is the formula for that? is it just LightColor.r*materialColor.r, LightColor.g*materialColor.g, LightColor.b*materialColor.b?

 

maybe something more complicated,

im trying to do realistic terrain lighting, i know i will have to compute sun light intensity (probably in candles or lumens) and define material light absorption since i grass is green because it absorps red and blue light and does not use green one.

 

 

 

Share this post


Link to post
Share on other sites
Advertisement

If i'm not wrong for foliage and grass you need to use subsurface scattering material to have correct shading if you really want a more realistic rendering.

Now for a classical shading, the specular color is simply the diffuse color, the final calcul is :

Light.Intensity * Light.Color * (SurfaceData.DiffuseColor * NdotL + SpecFactor)
Edited by Alundra

Share this post


Link to post
Share on other sites

Probably just repeating what Alundra said but if you think about it you have the following:

- A light that has a specific wavelength (LightColor) and intensity (LightIntensity)

- A material that has specific properties that absorb some amount of light and reflects the rest of it back (MaterialDiffuseColor)

 

The only thing that's left now is putting it together and combining it with the cosine angle between the incident light ray and the surface normal of your material (let's just say a flat grass textured surface) which describes the amount of light that hits the surface depending on this angle.

 

So the equation becomes:

float cosTheta_i = saturate(dot(surfaceNormal, -LightDirection)); // light direction from the surface point towards the light
float3 FinalDiffuse = (LightIntensity * LightColor) * MaterialDiffuseColor * cosTheta_i;
Edited by lipsryme

Share this post


Link to post
Share on other sites

i mostly cant imagine situatio when pure blue light lights pure red surface (this should give me LightColor * materialdiffcolor = 0,0,0 due 1,0,0 and light 0,0,1, or a pure red light, lights pure black surface, in other words i will see the light color on surface,

 

 

like this (wood colored with venge color (image shows light from mouse diode)

DSC_0002.jpg

 

 

 

 

 

 

this says something like ill need to define each material, but maybe theres a database i could download and review, maybe someone did that before.

 

 

I also wonder if this red light is the specularity or maybe its because (in this case real world that its not that pure red and pure black) wood surface (and paint surf) give the actual red (because theres some sort of red component in the paint)

Edited by WiredCat

Share this post


Link to post
Share on other sites

so what you are looking for is different shading methods and BRDF models links below may help:

 

https://en.wikipedia.org/wiki/Bidirectional_reflectance_distribution_function

https://en.wikipedia.org/wiki/List_of_common_shading_algorithms

 

also if you want to do realistic material you may need to take a look at layered material, also I don't think there is a material data base (or maybe there are such data bases) but I guess the artist is the one deciding the material. any ways nowadays renderers use a certain way of defining a material so you don't really need to define a way to represent you're own material. just go with what commonly is used.

 

well the material will certainly be defined by the BRDF function you choose to use, if you want to do PBR (physically based rendering), it'd be good to take a look at layered material structures, also be aware that the models you are going to use should also support these structures.

Share this post


Link to post
Share on other sites

For diffuse BRDF Lambertian BRDF is mostly used which is the usual "N dot L" but there is a more realistic model:

 

https://en.wikipedia.org/wiki/Lambertian_reflectance

https://en.wikipedia.org/wiki/Oren%E2%80%93Nayar_reflectance_model

 

The formulation is available in those links.

 

For the specular BRDF models the link below is a good reference:

 

http://graphicrants.blogspot.de/2013/08/specular-brdf-reference.html

 

But for specular lighting Phong shading and Blinn–Phong shading model are mostly used:

 

https://en.wikipedia.org/wiki/Phong_shading

https://en.wikipedia.org/wiki/Blinn%E2%80%93Phong_shading_model

 

Formulations are also included in those links.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement