Jump to content



how to render a two-sided mesh with correct illumination

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

#1 db123   Members   -  Reputation: 103

Like
0Likes
Like

Posted 25 February 2012 - 11:33 PM

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.
Posted Image
this is a screenshot with enable cull.
1.png

the following screenshot with disable cull. the white sign is the back face of this mesh.
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. Posted Image Posted Image Posted Image Posted Image


this is the mesh:
3.png
Posted Image Posted Image Posted Image Posted Image

Ad:

#2 Hodgman   Moderators   -  Reputation: 3232

Like
0Likes
Like

Posted 26 February 2012 - 12:55 AM

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.

#3 db123   Members   -  Reputation: 103

Like
0Likes
Like

Posted 26 February 2012 - 03:16 AM

View PostHodgman, on 26 February 2012 - 12:55 AM, said:

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.Posted Image Posted Image

#4 db123   Members   -  Reputation: 103

Like
0Likes
Like

Posted 26 February 2012 - 03:46 AM

View PostHodgman, on 26 February 2012 - 12:55 AM, said:

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 ~!!Posted Image Posted Image






We are working on generating results for this topic
PARTNERS