Jump to content

Double-sided Texture


Recommended Posts

Hi,

I am going to texture a leaf geometry and I'd like to use a double-layered shader, 1 texture for the frontal face and 1 for the back face of the leaf.

Note: I did take a quick look to the layer sop but I just managed to overlay 2 textures. I think I need to take the face normals into acount but how?

Thanx in advance

cheers

Link to comment
Share on other sites

you should just be able to do this by testing against the "I" vector against "N" if

the value will be -ve or +ve depending on which side is facing the camera.

here's some code (I haven't tryied compiling this)

if(dot(normalize(I),normalize(N))<0){

//back face code

}

else

{

//front face code

}

hope that helps

Link to comment
Share on other sites

you should just be able to do this by testing against the "I" vector against "N" if

the value will be -ve or +ve depending on which side is facing the camera.

here's some code (I haven't tryied compiling this)

if(dot(normalize(I),normalize(N))<0){

//back face code

}

else

{

//front face code

}

hope that helps

Hi doc,

thanx for the reply. I kind of understood the logic and tried to apply the code in VOPs , however, I couldn't manage to get it right.

Could you please be more specific. (I am not that experienced on VEX // VOPs so... :blink:)

thanx in advance

Link to comment
Share on other sites

Hi,

I managed to get it work. with the formula that you gave.

However, I have used the switcher VOP node instead of using "If then Block" node. Because "if node" didnt work ( it couldnt read the 0 input).

Am i doing somehing wrong ?

what are the principles to use "if then block" node

Link to comment
Share on other sites

Hey I don't have an output on my "if-then-block" node.

I know sounds a bit strange but there is no output :unsure:

I am able copy from the help file though.

Did this happende any of you guys before or Am I doing something wrong again :P

cheers

Link to comment
Share on other sites

Cheers, Symek

that helped.

Its a bit wierd though that you need to get in and go out. maybe it depends :P

anyways it works now

Thanx again.

well, the point is that this is a container for your stuff. That's why you jump into it. In many cases you want to make some job there - like in case of if-then statement in normal "hand written" code.

good luck!

sy.

Link to comment
Share on other sites

yep, that make sense. :P

I did a quick interface for the this double sided. The parameters that I put are quite basic. If you guys would like to change the interface interms off adding some other parameters or whatever.

please feel free about it.

Here is the hip file that I created by the help of "doc" and "Symek" ., that contains the VOP network.

double_sided_texture.hip

cheers

Link to comment
Share on other sites

yep, that make sense. :P

I did a quick interface for the this double sided. The parameters that I put are quite basic. If you guys would like to change the interface interms off adding some other parameters or whatever.

please feel free about it.

Here is the hip file that I created by the help of "doc" and "Symek" ., that contains the VOP network.

double_sided_texture.hip

cheers

Why not just use IsFrontFace vop to a switch? No need to wire up globals.

post-1155-1186786977_thumb.jpg

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...