• Advertisement
Sign in to follow this  

how to render a two-sided mesh with correct illumination

This topic is 2184 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

I can render two-sided mesh by set the cullmode to CULL_None, but when i illuminate it by a spot light, there is some black place where the back-face is.
sad.png
this is a screenshot with enable cull.
[attachment=7459:1.png]

the following screenshot with disable cull. the white sign is the back face of this mesh.
[attachment=7460:2.png]

I think the normal sampled from normal map is the normal for that pixel's reverse side, so my light can't illuminate it.

I wan't to know how to render the two-sided mesh with correct illumination, or get the correct normal for that pixel. sad.png sad.png sad.png sad.png


this is the mesh:
[attachment=7461:3.png]
sad.png sad.png sad.png sad.png

Share this post


Link to post
Share on other sites
Advertisement
Which graphics API/shader language are you using?

Depending on the shader language, you can use gl_FrontFacing, VFACE or SV_IsFrontFace to tell you if the current pixel belongs to a front-face or a back-face. If you're shading a back-face, you can flip the normal.

Share this post


Link to post
Share on other sites

Which graphics API/shader language are you using?

Depending on the shader language, you can use gl_FrontFacing, VFACE or SV_IsFrontFace to tell you if the current pixel belongs to a front-face or a back-face. If you're shading a back-face, you can flip the normal.


thank you, i use directx 11.smile.png smile.png

Share this post


Link to post
Share on other sites

Which graphics API/shader language are you using?

Depending on the shader language, you can use gl_FrontFacing, VFACE or SV_IsFrontFace to tell you if the current pixel belongs to a front-face or a back-face. If you're shading a back-face, you can flip the normal.

it works well, thank you ~!!smile.png smile.png

Share this post


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

  • Advertisement