Jump to content

How do I apply a material to the back side of a plane?


thrice
 Share

Recommended Posts

I.E., playing card with 2 sides. Not sure how to apply a material to the backside of a plane? I would think there must be support for this though, because of the fact that there is DEFAULTSIDE, FRONTSIDE, BACKSIDE, options right? Otherwise what is the point of having frontside backside?

Link to comment
Share on other sites

1 hour ago, NasimiAsl said:

this is a new way that look like standard material but called custom material 

http://www.babylonjs-playground.com/#YXCHH1

* notic that your normal most be reversed in back face

http://www.babylonjs-playground.com/#YXCHH1#1

 

Sorry I should have been more specific. How do I apply a different texture to the back of the plane? I.E., a playing card, you have a front side with the numbers, back side does not have numbers.

Link to comment
Share on other sites

On 5/28/2017 at 4:59 PM, JohnK said:

Two planes same position one FRONTSIDE one BACKSIDE. If any image interference separate slightly along plane normals

ah ok, that was going to be the next thing I tried but seemed wonky and figured it was built in due to the FRONTSIDE BACKSIDE options. But thinking through it further maybe that makes the most sense anyways, since each side has different interactions. Also the bigger thing I was hung up on was duplicating logic between the two planes if I take two and mash together but I suppose the best way to model it is parent plane with 2 child planes, then always target the parent when moving

Link to comment
Share on other sites

We can detect that without uv Changes just need change vNormalW in default shader and make new diffuseColor and samplerColor

in this case if we don't change uv map we can use atlas Map too for that

that can be support Extra Object too because we just change shader Not any Attribute of object

thinking about that

in my solution  we change vNormalW in varying to a simple global variable

and just need change it to -1.0 * VNormal if  gl_FrontFlag is Off ( for back face ) and some diffuse texture changes i test it in shader Builder  but for standardMaterial we need a few changes if you agree for this i can make sample 

 

 

 

 

 

Link to comment
Share on other sites

https://www.babylonjs-playground.com/#F5IEQE#6

i think some option of standard material use vNormalW and some other use normalW

 

normalW=gl_FrontFacing ? normalW : -normalW that used in default shader

but light don't correct normal in back side view

fun : https://www.babylonjs-playground.com/#F5IEQE#8

https://www.babylonjs-playground.com/#F5IEQE#9

 

Link to comment
Share on other sites

  • 2 weeks later...

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.

Loading...
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...