Shader-mixer: Double sided materials? YES! (SOLVED)

3WC3WC Posts: 1,116
edited January 2013 in The Commons

I have a weird question. For my latest project, I'm making a coat with a long tail. Is it possible to have a different material on the inside of the coat than the outside without making a separate mesh? Or do I have to duplicate the mesh on the inside. This was what I was trying, since I didn't think the first option was possible. But my vertex count goes way up, for one thing, and there is a lot of overlap since the inside mesh is so close to the outside.

Post edited by 3WC on
«13

Comments

  • KhoryKhory Posts: 3,854
    edited December 1969

    I know that it is possible with renderman shaders to have double sided normals. So I would guess that if you really knew your stuff you could do it with shader mixer or shader baker. That said, I am not sure anyone actually knows how.

  • adzanadzan Posts: 268
    edited January 2013

    Yes it's possible but not all software can make a double sided polygons. I know 3D Max, Maya, Shade, Houdini all support the feature. Not sure about blender or modo.

    Plus you'd need to check if Daz studio supports double-sided rendering. Poser can render them but it sometimes moans about it

    UVMapper Pro was able to make a model double sided but I haven't used it in many years so i'm not sure if it's still a feature

    Post edited by adzan on
  • cwichuracwichura Posts: 1,042
    edited December 1969

    I was under the impression that a mesh face always only has a single normal, no matter what. What can make a mesh appear "double sided" is the shader applied to it handling the normal and non-normal sides of the mesh independently. But as Khory points out, trying to create such a shader in Studio probably falls into the realm of Major Voodoo.

  • adzanadzan Posts: 268
    edited December 1969

    cwichura said:
    I was under the impression that a mesh face always only has a single normal, no matter what. What can make a mesh appear "double sided" is the shader applied to it handling the normal and non-normal sides of the mesh independently. But as Khory points out, trying to create such a shader in Studio probably falls into the realm of Major Voodoo.

    it's possible to have normals facing both sides of the polygons, by default Houdini makes all meshes double-sided.
    it's not used often in daz studio or poser because it can cause artefacts in the render, it used to crash Poser if it was being grumpy, and not all modelling software supports the feature, but it does come in handy sometimes

  • 3WC3WC Posts: 1,116
    edited January 2013

    Thanks for all the replies. So, I guess that's a "no", then? I'm probably not ready for major voodoo.

    This is what I find for blender:http://www.blender.org/development/release-logs/blender-246/shading-nodes/
    Maybe something similar could be done with shader mixer?

    Or the other method, which seems problematic. It seems that the materials show through one another, as the meshes are too close together. http://www.katsbits.com/tutorials/blender/double-sided-faces-different-materials.php#setupduplicates

    Post edited by 3WC on
  • KhoryKhory Posts: 3,854
    edited December 1969

    As I under stand it shader mixer/baker pretty much open up the potential to do any sort of shader that renderman is capable of. So if someone knew how it could be done. While it is not something that is the least bit helpful, velvet used on a surface in studio often has a different color inside than outside. I've always sort of assumed that this had to do with the double sided ability but have no way to prove it.

  • 3WC3WC Posts: 1,116
    edited December 1969

    Yeah, shader mixer is pretty much a mystery to me. Calling all shader masters! Little help, please?:cheese:

  • PendraiaPendraia Posts: 3,598
    edited December 1969

    wwes said:
    Yeah, shader mixer is pretty much a mystery to me. Calling all shader masters! Little help, please?:cheese:
    Just looking quickly at the link to the blender shader...it appears to have a front/back node. To my knowledge there isn't currently a brick for that in Shadermixer. I have no doubt that someone like Richard, MJC or Yacomo may know how to create it but it is way past my current knowledge level. I think it may be like the curves that someone would need to create a brick for it. I'm not sure who is able to do that. Someone maybe like ReDave or Zigraphix even. Or you could put a request in to bugtracker and ask them to create one.
  • 3WC3WC Posts: 1,116
    edited December 1969

    Well, I've been working on the mesh option, and I got it working pretty well, so maybe I'll just go with that for now. I opened a whole can of worms, didn't I?

  • Richard HaseltineRichard Haseltine Posts: 104,178
    edited December 1969

    The Variable brick will give the normal at the current point, so you could test that to see if it was pointing towards or away from the camera (the camera vector is also in the Variable brick) and if it was away use one set of values (lining) and if towards another (outside) - I think. Rendering at the moment so I can't check at all.

  • patience55patience55 Posts: 7,006
    edited December 1969

    This is an interesting topic :-)

    Have no idea if this will help or hinder the process but in Hexagon one can create double-sided face normals by welding them together. The shimmer is drastic of course but if the Shaders can handle it???

  • PendraiaPendraia Posts: 3,598
    edited December 1969

    This is an interesting topic :-)

    Have no idea if this will help or hinder the process but in Hexagon one can create double-sided face normals by welding them together. The shimmer is drastic of course but if the Shaders can handle it???

    As long as there are separate material zones I think so...but I think this is more about applying a different shader to each side of the polygon.

    If I've got this wrong...please feel free to let me know! ; )

  • Richard HaseltineRichard Haseltine Posts: 104,178
    edited December 1969

    I was just reminded of this, and had a quick tinker. This network gets a normal vector between the surface and the eye (the camera position) by taking a variable set to P (surface position) and subtracting it from E (the camera position), normalising the result, then taking the dot product of that with the surface normal to get a value that will be over or under zero depending on whether the surface is facing towards or away from the camera. Actually, I'm pretty sure this is a bad way of doing it - probably better to take a single variable, set to I (the incident vector), normalise that and dot product it with N, as this method will give the wrong result if viewed by means of a mirror. Anyway, compare the result of the dot-product with zero (greater or less than) and use that on an If brick to pick the shader value you want to use.

    NormalDependentColour.JPG
    982 x 979 - 96K
  • 3WC3WC Posts: 1,116
    edited December 1969

    Um, thanks.

    (I don't unnerstann a word that fella' jus' said!)

    No, thanks, I'll mess around with that and see what I can come up with.

  • BejaymacBejaymac Posts: 1,908
    edited December 1969

    Very nice Richard, it works well on this cut up cylinder, and yes that is two separate shaders on one material zone.

    two_in_one.jpg
    430 x 647 - 59K
  • PendraiaPendraia Posts: 3,598
    edited December 1969

    Bejaymac said:
    Very nice Richard, it works well on this cut up cylinder, and yes that is two separate shaders on one material zone.
    Very nice...
  • BejaymacBejaymac Posts: 1,908
    edited January 2013

    Like Richard says that doesn't work too good in reflections, you end up with the wrong effects showing in the reflection, his second suggestion does the business though, although I did have to change the Compare brick from Greater than to Less than, as the brick effect was being placed on the inside of the cylinder rather than the outside like I wanted ;)

    Edit

    You can even get bump/displacement to work with it XD

    two_in_one_x3.jpg
    758 x 647 - 60K
    two_in_one_x2.jpg
    758 x 647 - 70K
    Post edited by Bejaymac on
  • Midnight_storiesMidnight_stories Posts: 4,112
    edited December 1969

    How do you figure this stuff out Richard !
    I'm totally amazed :o

  • Richard HaseltineRichard Haseltine Posts: 104,178
    edited December 1969

    I remembered that the vectors were in the list of variables, and checked how the dot (and cross) product work via Wikipedia since it's been a long time since A-levels. Glad it's proving a useful starting point.

  • KatteyKattey Posts: 2,899
    edited December 1969

    So if I want to add a double-normals to usual shader, I just need to add it to default materials to get that network from previous page?

  • Richard HaseltineRichard Haseltine Posts: 104,178
    edited December 1969

    Yes, if I understand the question you juts need to use the vector stuff to distinguish between insdie and outside of the mesh, and then feed the result of the compare brick to an If brick controlling each property you want to be different (or to control the colour and opacity etc. fed to the root bricks, which ever is easier).

  • patience55patience55 Posts: 7,006
    edited December 1969

    um, any chance of somebody releasing that as a free shader for those of us who are brick blind?

  • Age of ArmourAge of Armour Posts: 437
    edited January 2013

    My math skills are nowhere near Richards level so I had to go a less mathy route haha.

    This shader just compares the Normalized Normal and Normal Forward. It works under a simple test but I don't know if it will hold up in a complex shader.

    Double_Sided_Shader2.jpg
    1392 x 507 - 106K
    Post edited by Age of Armour on
  • PendraiaPendraia Posts: 3,598
    edited December 1969

    How do you figure this stuff out Richard !
    I'm totally amazed :o

    Richard and Age of Armour are both very very clever...if Richard doesn't mind I'm happy to attempt to put together the network for people to play with and also Age of Armour's.

    I can generally follow where others lead...; ) lol

  • 3WC3WC Posts: 1,116
    edited December 1969

    Yes, this stuff is amazing. The one caveat being, however, that this will only work in Daz Studio, right? If we were to convert to a cr2, this won't work in Poser, isn't that true?

  • Richard HaseltineRichard Haseltine Posts: 104,178
    edited January 2013

    I'm happy for people to use this as they wish - it was posted as a contribution to the discussion for further development, sine I was too lazy to make a full shader.

    Yes, Shader Mixer is DS only - the Poser material room has N and P nodes, but I'm not seeing an equivalent of the I or V, or E, variables so I'm not sure how readily this could be done my way or using Age of Armour's approach. It might be worth trying to get BagginsBill's attention.

    Post edited by Richard Haseltine on
  • 3WC3WC Posts: 1,116
    edited December 1969

    Well, it's kind of a moot issue for me; I already added extra mesh to my project to make a double sided coattail. I think that's the best way to go for now. But at least we have something to play around with. I never realized the possibilities of shader mixer.

  • MattymanxMattymanx Posts: 6,975
    edited December 1969

    Just a note:

    By default, DAZ Studio will render normals forward regardless of what they are on the model itself. While this is useful for rendering in DS, if you export your scene to Lux Render, then the normals will be facing the same as they are on the model itself.

    Poser will not render normals forward by default. You need to go to the Material Room and on every surface, check off the "Normals Forward" box near the bottom.

  • Age of ArmourAge of Armour Posts: 437
    edited January 2013

    Pendraia said:

    Richard and Age of Armour are both very very clever...if Richard doesn't mind I'm happy to attempt to put together the network for people to play with and also Age of Armour's.

    I can generally follow where others lead...; ) lol

    Thanks but I don't know that I am clever... Some of the permutations I try just accidentally work once in a while haha.

    Feel free to use that network any way you like. I'm happy to contribute. If it weren't for you and others posting networks here in the forums I don't know that I would have ever figured out how to use Shader Mixer.

    Post edited by Age of Armour on
  • mjc1016mjc1016 Posts: 15,001
    edited December 1969

    Thanks but I don't know that I am clever... Some of the permutations I try just accidentally work once in a while haha.

    Funny how it is, that some of the carefully planned out, look like they should work on paper and follow all the 'rules' ones don't seem to work right, but the ones that you stumble upon on the way to something else turn out to be gems?

    I've always felt that messing in SM is more 'art' (as in the arcane type) than 'science'...sort of a digital alchemy.

Sign In or Register to comment.