Hello,
I am trying to write a BRDF, that depends on the uv coordinates. There is one case where the shader must be able to lookup the value for a certain parameter/attribute at a uv coordinate different from the uv coordinates of the point currently being evaluated.
I have seen the thread here on being able to sample a texture with uv coordinates as inputs, but, as I understand it, these textures must be bitmaps. But I would like to do this with any texture, is this possible?
Here is some more context.
In Maya, connecting an attribute to a checker texture gives the following in a .vrscene file
I currently get the texture and sample it at the current point like this.
But getting an EXT_BITMAP interface for this texture does not work, presumably because it is not a bitmap... But that means I can not access the getFilteredColor function.
Is there perhaps a way to alter or create your own VRayContext instance and set its ShadingData to have a certain uv coordinate, which can then be passed to getTexColor?
(I have done something similar in VRay for 3dsmax where I created an instance of 3dsmax's ShadeContext and modifying the uv coordinates. Then passing it to Texmap::EvalMono.)
Thank you very much for any help!
Kind Regards
Peter
I am trying to write a BRDF, that depends on the uv coordinates. There is one case where the shader must be able to lookup the value for a certain parameter/attribute at a uv coordinate different from the uv coordinates of the point currently being evaluated.
I have seen the thread here on being able to sample a texture with uv coordinates as inputs, but, as I understand it, these textures must be bitmaps. But I would like to do this with any texture, is this possible?
Here is some more context.
In Maya, connecting an attribute to a checker texture gives the following in a .vrscene file
Code:
... BRDFMyShader VRayMyShaderMtl1 { specular_strength=checker1@color::alpha; } TexChecker checker1 { compatibility_with=1; alpha_from_intensity=0; invert=0; color_mult=AColor(1, 1, 1, 1); color_offset=AColor(0, 0, 0, 1); alpha_mult=1; alpha_offset=0; nouvw_color=AColor(0.5, 0.5, 0.5, 1); uvwgen=place2dTexture1; white_color=AColor(1, 1, 1, 1); black_color=AColor(0, 0, 0, 1); contrast=1; } ...
Code:
... PluginBase *newPlug=param->getObject(i); TextureInterface *newSub=static_cast<TextureInterface *>(GET_INTERFACE(newPlug, EXT_TEXTURE)); VR::VRayContext *rc = (VR::VRayContext *)context; AColor col = newSub->getTexColor(*rc); ...
Is there perhaps a way to alter or create your own VRayContext instance and set its ShadingData to have a certain uv coordinate, which can then be passed to getTexColor?
(I have done something similar in VRay for 3dsmax where I created an instance of 3dsmax's ShadeContext and modifying the uv coordinates. Then passing it to Texmap::EvalMono.)
Thank you very much for any help!
Kind Regards
Peter
Comment