Jump to content

  • Log In with Google      Sign In   
  • Create Account


Standard emissive+ambient+diffuse+specular lighting model... how do texture and material settings combine?


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
5 replies to this topic

#1 JDX_John   Members   -  Reputation: 284

Like
0Likes
Like

Posted 13 February 2014 - 06:43 PM

The standard lighting used in OpenGL fixed-function (and I guess in D3D) basically boils down to:

color = material.emissive + material.ambient * light.ambient
      + material.diffuse * diffuseValue + material.specular * specularValue

Where diffuseValue and specularValue are calculated values.

 

But when you add a texture-map, how is this traditionally integrated i.e. how does it affect the emissive, ambient, diffuse and specular terms?

 

I assume emissive should not be modified. Should we replace material.ambient with material.ambient * textureValue and material.diffuse with material.diffuse * textureValue? Should specular BE affected by the texture map or not?

 

I'm aware there's probably a million valid ways it CAN be done. I'm mainly asking how the standard fixed-function pipeline does it.


www.simulatedmedicine.com - medical simulation software

Looking to find experienced Ogre & shader developers/artists. PM me or contact through website with a contact email address if interested.


Sponsor:

#2 InvalidPointer   Members   -  Reputation: 1354

Like
0Likes
Like

Posted 14 February 2014 - 12:14 AM

It just turns the specific value in question into something that can vary over the surface of a model instead of being uniform. Granted, ambient texture maps don't generally make sense, but it's just a question of scale and artistic intent.


clb: At the end of 2012, the positions of jupiter, saturn, mercury, and deimos are aligned so as to cause a denormalized flush-to-zero bug when computing earth's gravitational force, slinging it to the sun.

#3 Hodgman   Moderators   -  Reputation: 27021

Like
0Likes
Like

Posted 14 February 2014 - 12:19 AM


Granted, ambient texture maps don't generally make sense
Ambient lighting itself doesn't make sense wink.png

 

Ambient light is just diffuse light that comes from a magical "background"/bounce light, so both the "diffuse" and "ambient" results from this lighting model should be multiplied by the diffuse texture.

 

If present, the emissive term would be multiplied by an emissive map, and the specular term by a specular map.



#4 cozzie   Members   -  Reputation: 1420

Like
0Likes
Like

Posted 14 February 2014 - 03:53 PM

You could check this link on the d3d lighting model.

I'm not 100% sure if this is how the fixed pipeline does it though.

http://msdn.microsoft.com/en-us/library/windows/desktop/bb147178(v=vs.85).aspx



#5 JDX_John   Members   -  Reputation: 284

Like
0Likes
Like

Posted 17 February 2014 - 04:58 AM

You could check this link on the d3d lighting model.

I'm not 100% sure if this is how the fixed pipeline does it though.

http://msdn.microsoft.com/en-us/library/windows/desktop/bb147178(v=vs.85).aspx

 

That's a great link, but they nowhere mention how textures fit in. Only material and vertex colours are discussed :( Maybe material is synomous with texture, but I thought they were both supported simultaneously.


www.simulatedmedicine.com - medical simulation software

Looking to find experienced Ogre & shader developers/artists. PM me or contact through website with a contact email address if interested.


#6 DTR666   Members   -  Reputation: 182

Like
0Likes
Like

Posted 17 February 2014 - 08:12 AM

Hi,
Looking in an old OpenGL 2.0 spec, it seems that active texture replace fragment color, chapter 3.8.15:
 
"This texture value is used along with the incoming fragment in computing the texture function
indicated by the currently bound texture environment. The result of this function
replaces the incoming fragment’s primary R, G, B, and A values"
 
If you look, in chapter 2.14.1, you have the complete lighting equations. 
 
Hope this helps !





Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS