Inside Sabertooth
Learn how Sabertooth uses 3ds Max to create 3D interactive projects, including HBO Go’s Game of Thrones interactive experience
  • 1/3
You are here: Forum Home / Autodesk® Softimage® / Rendering / Offseting RGB of a texture, based on Y position
  RSS 2.0 ATOM  

Offseting RGB of a texture, based on Y position
Rate this thread
 
29896
 
Permlink of this thread  
avatar
  • Oz Adi
  • Posted: 26 February 2009 07:15 AM
  • Total Posts: 31
  • Joined: 19 February 2008 12:50 PM

Hi,

Render Tree “programing” is my weakest side…
I wonder if it’s possible at all, to create a shading network, that will offset the RGB values of the texture, based on let’s say, the Y position in Global space..

I am trying to created an effect, that the closer the geometry is to the camera, RGB values on the texture start sliding away, creating this out-of-phase blury thing :)

cheers,

Oz Adi



Replies: 0
avatar
  • mantom
  • Posted: 26 February 2009 09:28 AM

[quote=Oz Adi;19605]Hi,

Render Tree “programing” is my weakest side…
I wonder if it’s possible at all, to create a shading network, that will offset the RGB values of the texture, based on let’s say, the Y position in Global space..

I am trying to created an effect, that the closer the geometry is to the camera, RGB values on the texture start sliding away, creating this out-of-phase blury thing :)

cheers,

Oz Adi

If you want to apply this effect on a pixel-by-pixel basis, then mental ray is the way to go.  But if you want to apply the effect to the object as a whole based on it’s transform, then FXtree is probably the better option.  The XSI shaders out of the box don’t give you options to look up object transforms and use them in a shading network.  To do that would require writing your own shader code.  Not difficult, but you have to do it yourself.

For the pixel-based effect, use a vector_state shader and lookup the intersection point of the surface.  This will return the coordinate of the pixel being rendered in world space.  To be safe, pump the output into a vector_coordinate_converter and convert to world space, treating the vector as a point as technically mental ray performs the calculation in ‘internal space’, which is usually world space in this context, but not guaranteed.  see mental ray docs if you want the full explanation.  Anyway, after you have your vector, pull the Y coordinate as you desire and use that as input of a change_range.  Set your change_range to a desired output range (usually 0...1) and use that to drive your color shifts.  the change_range input range would be the min/max Y values you’d be willing to accept as valid input.

vector_state -> vector_coordinate_converter -> vector_to_scalars (pick Y) -> change_range -> whatever you want.


For object based effect, apply an expression to the object in question, and tie it to a parameter on an FXtree node that does your color correction.  Then render.


Matt



Replies: 0
avatar
  • sfu_sven
  • Posted: 26 February 2009 09:35 AM

[QUOTE=mantom;19611]The XSI shaders out of the box don’t give you options to look up object transforms and use them in a shading network.  To do that would require writing your own shader code.  Not difficult, but you have to do it yourself.

You could use ICE as Workaround. In ICE you can read out Object Transforms, write them into Scalar Attribute, and pipe them with an Attribute Shader into the Render Tree. It works with Particles, don’t know if it’s working with Objects, but you can give it a Try.



Replies: 0
avatar
  • Oz Adi
  • Posted: 28 February 2009 08:14 PM

Thanks guys!

I got it to work, using the shading network you suggested, Matt..
I got two textures, one normal, second one phased, and I mix between two,
using the Y position in world space…

thanks, again..

Oz.



Replies: 0