peship Posted July 15, 2005 Share Posted July 15, 2005 ok, imagine we have object with attatched shader(s). now we want to get the color ( whay not and alpha ) at any point of the object's surface. what is the right way to do that ? thanks Quote Link to comment Share on other sites More sharing options...
aracid Posted July 15, 2005 Share Posted July 15, 2005 ok, imagine we have object with attatched shader(s).now we want to get the color ( whay not and alpha ) at any point of the object's surface. what is the right way to do that ? thanks 19548[/snapback] hey hey i' just want to understand ur question a bit better... is that at render time? or would u like to use that info in ur scene? ie point sop all the best aracid Quote Link to comment Share on other sites More sharing options...
peship Posted July 15, 2005 Author Share Posted July 15, 2005 both EDIT: What i'm asking is not how to operate with point attributes. The problem is that i'm not really sure how to read the shading data along the surface. Quote Link to comment Share on other sites More sharing options...
sibarrick Posted July 16, 2005 Share Posted July 16, 2005 Not 100% sure I follow the question. But in a shader you can do a trace call to find the alpha and colour of a surface. Is that what you want? You can't do that in a sop though you'd have to go with the point attributes only, or bake the texture into a map and then read that via a sop using uv. Quote Link to comment Share on other sites More sharing options...
Mario Marengo Posted July 16, 2005 Share Posted July 16, 2005 ok, imagine we have object with attatched shader(s).now we want to get the color ( whay not and alpha ) at any point of the object's surface. what is the right way to do that ? 19548[/snapback] Shading values on a surface are calculated by shaders at render time, and so for those values to exist in the first place, you must render the scene. But since you don't make it clear in your post whether the color values you're intending to look up are per-vertex or continuous, then I'll assume you mean for them to be continuous across the surface, and so discard the possibility of using the BakeVEX SOP which only works for parametric surfaces and provides you with per-geometric-point shading values only (i.e: not continuous). If all of the above is true, then one way to accomplish the lookup would be as follows: 1. Render your scene with the shaders whose values you intend to look up later. This produces an image which we'll call "pass1.tif". 2. Assign the final shaders to your objects passing them, as a parameter, the result of step 1: "pass1.tif". When the final shaders need to look up the value of pass1.tif they use a texture() function indexed by the NDC transformation of the point being shaded (P) like this: //...// // Assuming "pass1.tif" exists, then: vector Pndc = toNDC(P); vector4 Cpass1 = vector4(texture("pass1.tif", Pndc.x, Pndc.y, "filter","point", "mode","black", "border",{0,0,0,0})); // Cpass1 will now hold the RGBA of pass1 at the current position P //...// Both shaders could be combined into one and other solutions very likely exist, but none of these can be suggested unless you make your question a lot more specific (I'm not being pedantic, it's just the simple truth, sorry). Hope that helps, Cheers! Quote Link to comment Share on other sites More sharing options...
peship Posted July 16, 2005 Author Share Posted July 16, 2005 Thanks for the answer Mario. The texture function did the job - all the time i searched for functions with names containing "*uv*" strings Maybe i wanted too mutch ( to read the whole shader stuff ), simple texture is enough. EDIT: Being long time Maya user i got used to all those *Info shading nodes. Quote Link to comment Share on other sites More sharing options...
Mario Marengo Posted July 17, 2005 Share Posted July 17, 2005 Being long time Maya user i got used to all those *Info shading nodes. Yeah, this is more of a Renderman-ish way of doing things... in fact, barring some tiny syntactic details, it's identical (by design). Glad it helped, Cheers! Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.