Gradient Shader
-
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 02/09/2012 at 17:01, xxxxxxxx wrote:
I'm using Python but maybe you need to use something like InitRenderStructure()
and InitRender(gr) ?
Then possibly get the pixel at UVW x,y.
Haven't done it with a gradient shader but rather a Color Gradient Userdata.Cheers
Lennart -
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 03/09/2012 at 00:53, xxxxxxxx wrote:
Hello Klaus,
BaseContainer::GetCustomDataType() accepts two arguments. The first one is the ID of the description element, the second the ID of the data-type.
Gradient* gr = (Gradient* ) d.GetCustomDataType(MY_GRADIENT_ID, CUSTOMDATATYPE_GRADIENT);
If the gradient is part of your own description for your plugin, you need to initialize it in NodeData::Init().
-Niklas
-
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 03/09/2012 at 01:08, xxxxxxxx wrote:
Originally posted by xxxxxxxx
Hello Klaus, BaseContainer::GetCustomDataType() accepts two arguments. The first one is the ID of the description element, the second the ID of the data-type.
Gradient* gr = (Gradient* ) d.GetCustomDataType(MY_GRADIENT_ID, CUSTOMDATATYPE_GRADIENT);
I think the 'd' in this case is a GeData, not a BaseContainer, and so there's only one argument. I would check the value in the DescID() call, is 1000 really correct?
Steve
-
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 03/09/2012 at 02:01, xxxxxxxx wrote:
Hi Steve,
yes, d is GeData d. I'm going this way successfully to get the gradient type :
GeData d; LONG type = 0; if (sh->GetParameter(DescLevel(1001), d, DESCFLAGS_GET_0)) // SLA_GRADIENT_TYPE 1001 { type = (LONG)d.GetLong(); // => e.g. 2000 for SLA_GRADIENT_TYPE_2D_U }
So I assume the way to get the data is pricipally right.
@Niklas: no it's not my plugin using the gradient. I want to get it from a material.
Here are the IDs of Xs**gradient.h
Xs**gradient = 1000, SLA_GRADIENT_TYPE = 1001, // LONG SLA_GRADIENT_TYPE_2D_U = 2000, SLA_GRADIENT_TYPE_2D_V, SLA_GRADIENT_TYPE_2D_DIAG, SLA_GRADIENT_TYPE_2D_RAD, SLA_GRADIENT_TYPE_2D_CIRC, SLA_GRADIENT_TYPE_2D_BOX, SLA_GRADIENT_TYPE_2D_STAR, SLA_GRADIENT_TYPE_2D_FOUR_CORNER, SLA_GRADIENT_TYPE_3D_LINEAR, SLA_GRADIENT_TYPE_3D_CYLINDRICAL, SLA_GRADIENT_TYPE_3D_SPHERICAL, SLA_GRADIENT_CYCLE = 1002, // Bool SLA_GRADIENT_START = 1003, // Vector SLA_GRADIENT_END = 1004, // Vector SLA_GRADIENT_RADIUS = 1005, // Real SLA_GRADIENT_SPACE = 1006, // LONG SLA_GRADIENT_SPACE_TEXTURE = 2020, SLA_GRADIENT_SPACE_OBJECT, SLA_GRADIENT_SPACE_WORLD, SLA_GRADIENT_SPACE_CAMERA, SLA_GRADIENT_SPACE_SCREEN, SLA_GRADIENT_SPACE_RASTER, SLA_GRADIENT_TURBULENCE = 1011, // real ...
-
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 03/09/2012 at 02:23, xxxxxxxx wrote:
I tried the code from Niklas using a base container. That's also the way the gradient sdk eample uses. Type is correct, but the gradient pointer is NULL!
BaseContainer *bc = sh->GetDataInstance(); Gradient *gr = (Gradient* )bc->GetCustomDataType(1000, CUSTOMDATATYPE_GRADIENT); // => NULL LONG type = bc->GetLong(1001); => correct values
-
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 03/09/2012 at 07:09, xxxxxxxx wrote:
Right, 1001 does indeed work as the gradient type. However, the actual colour gradient is not 1000 but 1007 (defined as SLA_GRADIENT_GRADIENT) - try that and see if it works.
Steve
-
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 03/09/2012 at 08:09, xxxxxxxx wrote:
Yep! That's it. Don't understand, how I could miss it in the h file.
SLA_GRADIENT_GRADIENT = 1007, // Gradient
-
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 03/09/2012 at 12:24, xxxxxxxx wrote:
Easily done, I've achieved that error many times
Steve
-
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 03/09/2012 at 13:12, xxxxxxxx wrote:
Hi Klaus,
why are you not using the actual symbols in the code?
-Nik
-
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 04/09/2012 at 02:27, xxxxxxxx wrote:
you mean the resource IDs? I do so normally, but xs**gradient.h couldn't be found by the compiler. So I would have to setup a path, but I wasn't sure until now, that it is the right file.