OGL Randomtexture

   3853   5   2
User Avatar
Member
34 posts
Joined: 12月 2008
Offline
Hey Community,

I have a shader which generates a random color, how do I output the Colorinformation to the OGL Diffuse color, so that I can see the randomly created colors in my viewport?

Thanks!
User Avatar
Member
252 posts
Joined: 7月 2005
Offline
You could create the random color as a point or primitive attribute and pass it to your OpenGL shader to use, or write an OpenGL shader that uses a similar algorithm as the other shader you created (which I am assuming is a VOPs/VEX Mantra shader since you didn't specify).

If your other shader is a VOP or VEX or Renderman shader, it can't really communicate to an OpenGL shader (nor would you really want it to).

-c-
User Avatar
Member
34 posts
Joined: 12月 2008
Offline
Its a VOP VEX Surface SHOP Shader.

Can I somehow acces the output color values from outside?

All outputs I get is:
ch(“../vopsurface1/output1”)
User Avatar
Member
34 posts
Joined: 12月 2008
Offline
anyone?

:?:
User Avatar
Member
1390 posts
Joined: 7月 2005
Offline
fux00rdb00nsh!t
Its a VOP VEX Surface SHOP Shader.

Can I somehow acces the output color values from outside?

All outputs I get is:
ch(“../vopsurface1/output1”)

If I understand you correctly, I'm afraid you can't. VEX in a surface shader is evaluated during rendering based on variables generated while mantra proceeds with geometry. Thus you cannot access this data prior Mantra starts render. You could prepare your code so it can operate in SOPs (don' relay on Mantra variables), but it would have to work on per point basis not per sample of micro-polygon, so you won't get the same results.

Channel expression you showed is an input user data, not an output of Mantra.

The usual way to get Mantra variables in SOP is to bake them into texture and reproject onto geometry.


hth.,
skk.

PS Random texture on primitive in OGL requires one shader per primitive.
User Avatar
Member
252 posts
Joined: 7月 2005
Offline
If you want to see them interactively then they need to be a point/vertex/primitive attribute on your geometry, or it needs to be in a texture that is read, or you need to create an OGL shader that does your random coloring.

But… if you did your random color generator as a network in VOPs, you could potentially copy and paste that network into a SOP VOP and color your points with the same network that your shader uses at render time.

But like Steven said, shader code generates when Mantra is run and therefore it isn't available to your interactive session.

-Craig
  • Quick Links