Oritenting shader towards camera?

YofielYofiel Posts: 204
edited December 1969 in Carrara Discussion

Is there a way to orientate an asymmetirc shader with respect to the current camera position? For example, to change the orientation of a texture map depending on the camera position?

Comments

  • wetcircuitwetcircuit Posts: 0
    edited December 1969

    can you just tell us the situation? Might be easier....

    There is a specific primitive called a SPLAT that is a rectangle that always faces the camera...

  • YofielYofiel Posts: 204
    edited December 1969

    Err...I'm trying to abstract the problem so it applies to other users. Say for example I have an ierregular mesh and I'm drawing a bitmap on each surface. I think it would be cool to change the orientation of the bitmap on each polygon, either to be at a particular angle to the camera, or to another object, at an angle to the scene. I saw a tutoorial saying the 'snow' terrain shader makes its children shaders visible only if they're facing upwards. That's good for snow. Is there a generalized shader which provides more arbitrary controls to change the angle of children shaders?

  • YofielYofiel Posts: 204
    edited January 2013

    Here's an example: a smiley face on a sphere. I can use 'spherical projection' to make the smiley face face outwards, but what I was wondering about doing was whether I could get all the smileys to rotate so the eyes are at the same angle with respect to the camera position. It would involve being able to change the angle of the subshader with respect to the normal of the face of the central vertex for the bitmap, and the camera. I don't know if it's possible.

    Capture.JPG
    1028 x 333 - 76K
    smiley.gif
    120 x 120 - 5K
    Post edited by Yofiel on
  • wetcircuitwetcircuit Posts: 0
    edited December 1969

    There are several:
    FALLOFF SHADERS go from minimum to makimum depending on the mesh angle to the camera. (Best falloff shader imo is in DCG's SHADER OPS)

    the ENVIRONMENT SHADER has many controls (elevation, slope, etc) for 3D space

    For a plugin that sounds very specific to what you are describing check out SHADER OPS http://www.digitalcarversguild.com/plugin.php?ProductId=11
    it has many controls to move and manipulate a map. Combined with the Fake Fresnel falloff shader in this plugin you could do a lot of texture mangling....

  • YofielYofiel Posts: 204
    edited December 1969

    Dear Holly

    Fantastic. Thank you very much:)

    All the best
    E

    Doc3.png
    640 x 480 - 80K
  • wetcircuitwetcircuit Posts: 0
    edited December 1969

    emeyer said:
    Dear Holly

    Fantastic. Thank you very much:)

    All the best
    E

    GREAT!

    Although I'm still not sure what you were trying to do... :red:

  • YofielYofiel Posts: 204
    edited December 1969

    Well, I started to play with the environment shader, and it has many options. What I was curous about was putting a smile-shaped bump map on top of a water texture, like in the ocean in Botticelli's 'Birth of Venus.' But I think it's going to take a week or so just learning about shaders before I can actually make it.

  • YofielYofiel Posts: 204
    edited December 1969

    Ok, what I did so far was create a test scene. This is a model of a white poppy from a public-domain 3DS file, replicated on a ''rolling hills' terrain preset with the surface replicator. While I don;t mind the flower being exactly the same in this case, I find the color of the flowers too uniform for my taste, and want a subtle variation of it. The angle of the flowers varies randomly by 10 degrees, so I want to vary the color depending on the angle to the camera, and I believe it should work even though the replicator is drawing exactly the same model for each apparent instance.

    poppies6.jpg
    1024 x 768 - 402K
  • thoromyrthoromyr Posts: 452
    edited December 1969

    emeyer said:
    Ok, what I did so far was create a test scene. This is a model of a white poppy from a public-domain 3DS file, replicated on a ''rolling hills' terrain preset with the surface replicator. While I don;t mind the flower being exactly the same in this case, I find the color of the flowers too uniform for my taste, and want a subtle variation of it. The angle of the flowers varies randomly by 10 degrees, so I want to vary the color depending on the angle to the camera, and I believe it should work even though the replicator is drawing exactly the same model for each apparent instance.

    It won't work unless you convert the replicator to real objects. All information about each instance is simply copied from the master object where ever that is. For example, to make the flower color shift is really quite simple: use an appropriate color gradient with a *global* space noise shader. But with replicated objects it will be the same for each object, for this to work they must be individual/real objects -- not replicated :(

    Altering the gradient by the angle of the flowers should be possible, though it might well require an extension. For example, using Fenric's ERC to make rotation angle drive a value in the shader that feeds into the gradient selector.

    Shader Ops 2 by Digital Carvers Guild has some really powerful tools with light mangler and space mangler. Off the top of my head I don't remember just how space mangler works and it may apply to some of your idea, but light mangler is really cool. For example, driving color selection (or anything else) by the amount of illumination (or pretty much anything else, such as alpha, subsurface scattering, etc.) on the pixel.

  • thoromyrthoromyr Posts: 452
    edited January 2013

    as to your original question, I think Camera Mapping (Digital Carvers Guild, Shaper Ops 2 might be what you were after.

    edited to add picture

    Screen_Shot_2013-01-25_at_9.22_.49_PM_.png
    802 x 653 - 233K
    Post edited by thoromyr on
  • wetcircuitwetcircuit Posts: 0
    edited December 1969

    Also look at Inagoni.com for REPLICA which can do instances with a color variation, but I'm not sure if you can control it or it's random....

  • YofielYofiel Posts: 204
    edited December 1969

    Hi folks, thank you for answers and apologies for delay, I've been learning alot...I think I can do something basic like this

    : set two terrain layers with different colors and adjust the blend depending on direction.

    Therefore with say half a dozen derrain nodes, I could make every instance a different color depending on the orientation.

    But I understand the shader might pick up the orientation of the original, rather than the orientation of the current replicated instance, unless I convert every instance to an object, which is not feasible for a field of poppies say, the size of the one in the Wizard of Oz.

    I'm going to try it this week, but what I think at the moment is, if the terrain shaders don't change for each replication, that would seem to me to be a sorry lacking in the product, if not a bug, regrets to make the obseravation, but on the other hand, I expect it to work )

  • evilproducerevilproducer Posts: 9,050
    edited December 1969

    emeyer said:
    Hi folks, thank you for answers and apologies for delay, I've been learning alot...I think I can do something basic like this

    : set two terrain layers with different colors and adjust the blend depending on direction.

    Therefore with say half a dozen derrain nodes, I could make every instance a different color depending on the orientation.

    But I understand the shader might pick up the orientation of the original, rather than the orientation of the current replicated instance, unless I convert every instance to an object, which is not feasible for a field of poppies say, the size of the one in the Wizard of Oz.

    I'm going to try it this week, but what I think at the moment is, if the terrain shaders don't change for each replication, that would seem to me to be a sorry lacking in the product, if not a bug, regrets to make the obseravation, but on the other hand, I expect it to work )


    You do know that you can add multiple objects to the replicator so that if you have five different flowers, each with a variation in color. You'll get a more varied look in the replicator. In the real world, flowers colors don't change color because they're bent ten degrees more than the the one further up the slope.


    I do agree that it would be nice to have some additional features in the replicator, but I wouldn't consider it a bug because it doesn't do what you want. Go to the bug tracker, describe what you would like as you did here in the forum, and put in a feature request.

  • thoromyrthoromyr Posts: 452
    edited December 1969

    emeyer said:
    Hi folks, thank you for answers and apologies for delay, I've been learning alot...I think I can do something basic like this

    : set two terrain layers with different colors and adjust the blend depending on direction.

    Therefore with say half a dozen derrain nodes, I could make every instance a different color depending on the orientation.

    But I understand the shader might pick up the orientation of the original, rather than the orientation of the current replicated instance, unless I convert every instance to an object, which is not feasible for a field of poppies say, the size of the one in the Wizard of Oz.

    I'm going to try it this week, but what I think at the moment is, if the terrain shaders don't change for each replication, that would seem to me to be a sorry lacking in the product, if not a bug, regrets to make the obseravation, but on the other hand, I expect it to work )

    I hate to tell you, but I've been down that road before. It wasn't the numbers you are suggesting so I got by with creating instances. A variety of things don't work right with replicated objects, for example, if the position is randomized then an effect will be applied to the unrandomized position.

    Agreed that it is a serious shortcoming and probably worth filing a bug report about.

    Now, if a relatively small number of orientations suffice you could do those and not mess with orientation as an input and just add all of them to the replicator. By having it vary the orientation a bit to avoid to much uniformity you might be able to achieve the effect you are after.

  • thoromyrthoromyr Posts: 452
    edited December 1969

    heh. I agree with evilproducer that it isn't a bug, but IMO it is a serious shortcoming that replicated objects don't use their actual position for global. I recognize that using the position/orientation of the master is part of what improves the performance, but even if it is was only a render time lookup for shaders or whatever else it would be a significant improvement.

    Thinking about it, it is entirely possible that use of the master's information is part of the architecture. But I'd think it could be made more flexible without rewriting replicators.

  • YofielYofiel Posts: 204
    edited December 1969

    BUT TERRAIN TEXTURE CHANGES ON REPLICATED OBJECTS WORK!!!!

    Here's a quick demo with a single hyacinth in a surface replicator on a simple plane with mostly default settings. I put two terrain subshaders at different orientations and it's so luscious it's almost edible. Maybe it didn't work before and it was fixed. Thank you Daz :)

    Doc3.png
    640 x 480 - 522K
  • thoromyrthoromyr Posts: 452
    edited December 1969

    Maybe. It may depend on additional parameters. I wasn't replicating on a surface and not all objects are equal.

    Glad you tried it anyway and I'm glad it worked for you!

  • YofielYofiel Posts: 204
    edited February 2013

    Yes, thank you. I still have to tint the texture maps, rather than simply put solid colors in for the variations.

    The other object with which I had trouble so far was arrays of pillars. The marbling on every pillar was so similar, it just looked silly. So here is a test on some variation with regular replicator, not a surface replicator.

    There is slightly different marble textures in two terrain channels. But the randomization in angle is hit and miss, and all I can do is spin the cylinder around the Z axis to get a different angle to the camera. With such a small number of large objects, some of them tend to look much the same.

    I think what I really need is Veloute's replicator, to obtain more precise control of the replication. Also by appearances the Veloute one represents the full object in the assembly room, rather than bounding lines, which would make it easier to position characters around the pillars. So I think that's what I am going to get, as well as Deeper and SWAP, and, I guess, the Veloute shaders first, and shader ops later, but that being said, I understand it still may not work for other primitives, perhaps particle ones are the most difficult.

    Doc5.png
    800 x 354 - 577K
    Post edited by Yofiel on
  • evilproducerevilproducer Posts: 9,050
    edited December 1969

    Glad you got the flowers working!

Sign In or Register to comment.