Search - User list
Full Version: How to sample material/texture
Root » Houdini Engine API » How to sample material/texture
sukoy
Hi

In the last days I'm looking in the c++ sdk to find how to semple a material and a texture.
The idea is quite simple giving in input uv get color sample from material or a texture.
  1. A SOP node I think is not the right way because its aiming to modify or generate geometry
  2. A VOP node as well I don't think because I'm looking for the shader result not to the shader it self
  3. A VEX script? Create a vex node, place it in the graph only to store the material reference, really?
I'm a little confused and the examples doesn't help me.
Thanks
sukoy
About how to fetch a texture the best way I found is to retrieve an ImageHandle from ImageCache

virtual ImageHandle* ImageCache::get_image_handle(ustring filename,Perthread * thread_info = NULL )

and then use the handle to get the pixels

virtual bool get_pixels (ImageHandle *file, Perthread *thread_info, int subimage, int miplevel, int xbegin, int xend, int ybegin, int yend, int zbegin, int zend, int chbegin, int chend, TypeDesc format, void *result, stride_t xstride=AutoStride, stride_t ystride=AutoStride, stride_t zstride=AutoStride, int cache_chbegin=0, int cache_chend=-1)=0

is this the fastest way?

Thanks
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Powered by DjangoBB