[osg-users] Material Properties to Change the Normal Intensity

Sebastian Messerschmidt sebastian.messerschmidt at gmx.de
Tue Dec 27 07:21:23 PST 2016



Am 26.12.2016 um 23:56 schrieb Rômulo Cerqueira:
> Hi Sebastian,
>
>
>> Are you planning on using the bump-maps alpha channel, or which alpha do you plan to use.
>>
>
> I wanna to pass a reflectance value to be multiplied by the normal map (normNormal in fragment shader) to simulate real situations. For example, a steel cube (e.g. reflectance = 1.12) should reflect more than a plastic cube (e.g. reflectance = 0.6) for a real sonar. In this case, I need to pass this "reflectance" value to shader for each object present in the scene.
Ok, then apply your normal-map and perform your calculation. Pass the 
reflectance either as

1) vertex attribute
2) uniform
3) in any fixed-state attribute (e.g. misuse the gl_FrontMaterial (via 
osg::Material))

So the simplest way is to add a float-uniform to the object to be 
modified and multiply your result with its value.
The osgshaders example shows how to transport these values between the 
application and the shader. But this works properly only if you 
structure in a way that you can control the individual state-sets.

>
>
>> What kind of input geometries do you use? Are the objects with the different reflectances models or can one model have multiple parts with different reflectance values?
>>
>
> Any kind of geometries: cubes, spheres, cones, structures... Initially all parts of the same object will have an unique reflectance model.

Ok, maybe my question was unclear: How are the parts strucured in terms 
of osg-nodes? In case you want to control per-object state you need to 
have it separated so it has its own stateset.


Cheers
Sebastian
>
> ...
>
> Cheers,
> Rômulo[/quote]
>
> ------------------
> Read this topic online here:
> http://forum.openscenegraph.org/viewtopic.php?p=69770#69770
>
>
>
>
>
> _______________________________________________
> osg-users mailing list
> osg-users at lists.openscenegraph.org
> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org




More information about the osg-users mailing list