math ross


About Me

Not Specified
Not Specified


Recent Forum Posts

Shader Translator Help - Redshift 2022年7月31日19:58

I would need help getting started on a Shader Translator for Redshift.
I have been successfully making objtranslators for Redshift but am lost with the shadertranslators.
I have been looking at the code in ../husd/ as well as the examples in ../husdplugins/shadertranslators and i am a bit overwhelmed.

It seems like it would be simple, but i am lost in the amount of methods.
Any kind of help sending me in the right path would be greatly appreciated.

What i am looking to do is convert redshift_material -> redshift_usd_material
Theses nodes usually reside in a redshift_material_builder(redshift_vopnet)
Reason being that redshift_material does not convert to usd

HDK SceneRenderHook - get camera info 2022年6月23日9:39

For those interested, is was able to get the camera position with:

// Parameter from DM_SceneRenderHook.render(RE_Render *r, ...)
RE_Render *r;

// View matrix
UT_Matrix4D view_mat;

// Camera position
UT_Vector3 camera_pos = UT_Vector3(0,0,0);
camera_pos = rowVecMult(camera_pos, view_mat);

And was able to convert the 3D point to screen space with:

// Parameter from DM_SceneRenderHook.render(RE_Render *r, ...)
RE_Render *r;

// 3D point
UT_Vector3 pos3;

// View matrix
UT_Matrix4D view_mat;

// Projection matrix
UT_Matrix4D proj_mat;
r->getMatrix(proj_mat, RE_MATRIX_PROJECTION);

UT_DimRect viewport = r->getViewport2DI();

// World position
fpreal xw = pos3.x();
fpreal yw = pos3.y();
fpreal zw = pos3.z();
// Screen position
fpreal xs;
fpreal ys;

r->mapScreen(xw, yw, zw, viewport, proj_mat, view_mat, &xs, &ys);

HDK SceneRenderHook - get camera info 2022年6月20日10:34

Hi its my first time using the HDK. My goal is to make a scene scale visualiser similar to the one from speedtree. A vertical ruler on the right of the object with the measurement shown in text at the top of it.

I am using the SceneBoundsHook.C sample scene as a base and have been able to modify it to work on selected objects and make custom geo.

What i am missing is a way to get the camera info. In cases where there is a node in the scene for it or its the default perspective camera.

With the camera world transform and its view transform i would be able to:
- Make the custom geo look at the camera at all times.
- Convert a 3d point to a viewport 2d point in order to place text.

Thank you in advance i am new to the hdk and it can be hard to know where to look at the beginning.