Shader Mixer: Object's Origin

Does anybody know if a shader can be created in shader mixer can get the xyz coords of the origin of the current object being rendered at rendertime?

I've been developing a shader that requires this information, and what I've been doing up to this point is creating new parameters for the shader that store the xyz coords of the origin of the object. Before rendering, a script writes the xyz coords for each material. This works fine, but ultimately I want to have lots of objects with this shader applied (thousands), and I'm concerned that each having their own unique material will be problematic. It would be much better if there was only one material that grabbed the info while rendering.

If anybody has any thoughts, ideas or experience, it would be greatly appreciated!

- Greg

 

Comments

  • It might be possible - you can convert coordimates from object space (the default, I think) to world space so a bit of arithmetic might give the origin. I don't think it would handle rotation though.

  • It might be possible - you can convert coordimates from object space (the default, I think) to world space so a bit of arithmetic might give the origin. I don't think it would handle rotation though.

    Awesome - that makes sense. Thank you very much, Richard.

    /salute

    - Greg

  • djigneodjigneo Posts: 283

    You've piqued my curiousity. What sort of shader are you developing?

  • djigneo said:

    You've piqued my curiousity. What sort of shader are you developing?

    It's a shader that I first wrote 20+ years ago, which was primarily used for rendering huge numbers of extremely low-poly trees. I haven't even thought about it since the late 90s, but I find myself having a use for it in my current work on non-photorealistic rendering. Anyway, the normals for each point on the surface of the geometry are calculated on the fly based on the UV coords, viewing angle, and some assumptions that can be made about the simple geometry.

    I believe Richard's idea is a good one and will work. I'll be psyched if I can get it working! If you'd like, I'll upload some tests once I get it up & running.

    Do you do any work with Shader Mixer?

    - Greg

     

  • djigneodjigneo Posts: 283
    edited September 2015
    Not yet. It's definitely on my to do list. Been getting familiar with scripting and working on a toolset for my workflow. At some point I'd like to make some basic edits to the shaders I use.
    Post edited by djigneo on
  • Personally, I find Shader Mixer to be an incredibly powerful tool, especially when combined with scripting to intelligently apply shaders on a per object basis and set parameters dynamically. These tools, along with access to all the content, are what makes DAZ incredible. 

    I'm no expert, but if I can help save you some time (especially as you initially get into it), I'd be happy to try. You'll find many talented people here on the forums (both artisitically, as well as technically) who are willing to share their experience. Richard's response in this thread is a prime example.

    - Greg

  • djigneodjigneo Posts: 283
    Thanks, Greg. I'll drop you a pm.
Sign In or Register to comment.