opengl - Blending lightmap with diffuse texture -


i'm using c++, opengl 4.0 , glsh shader language.

i'm wondering how correctly blend diffuse texture lightmap texture.

let's assume have room. every object has diffuse texture , lightmap. in every forum gamedev.net or stackoverflow people say, textures should multiplied. , in cases gives results, objects close light source (for example white bulb). light source close objects generates white lightmap. when multiply diffuse texture white lightmap, original diffuse texture color.

but if light source close object, color of light should dominant

it means, if white, strong light close red wall, part of wall should white, not red!

i think need more 1 lightmap. lightmap don't have information light intensity. means, shiny color maximum diffuse color.

maybe should have 2 textures - shadowmap , lightmap? equations should looks this:

vec3 color = shadowmapcolor * diffusetexturecolor + lightmapcolor; 

is approach?

generally speaking, if you're still using lightmaps, not using hdr rendering. , without that, want not particularly reasonable. unless light map provides light intensity hdr floating-point value (perhaps in gl_r11f_g11f_b10f or gl_rgba16f format), not going work well.

and of course, you'll have usual stuff hdr, such tone mapping , forth.

lastly, additive equation makes no sense. if light map color represents diffuse interaction between light , surface, adding light map color doesn't mean anything. standard diffuse lighting equation c * (dot(n, l) * * d), i light intensity, d distance attenuation factor, , c diffuse color. value lightmap presumably parenthesized quantity. adding doesn't make sense.

it still needs multiply surfaces's diffuse color. over-brightening due effective intensity of light function of d.


Comments

Popular posts from this blog

html - How to style widget with post count different than without post count -

How to remove text and logo OR add Overflow on Android ActionBar using AppCompat on API 8? -

javascript - storing input from prompt in array and displaying the array -