Terrain shader parameter


#1

Are there the world parameters sunColor, sunIntensity and sunDirection, which I could set as fragment shader parameter? If yes, how to do that?


#2

I have not yet looked. This might prove useful.

http://jsref.docs.highfidelity.com/docs


#3

Darn, I’ve needed one of those for a long time.


#4

Thanks for the hint. :wink: I have not thought, that I would need Javascript. Is the following solution possible?

  1. Set the property ParentID of the terrain to the entityID of the skybox zone.

  2. Write the URL of the following script into the field “script url” of the terrain:
    var sunProperty = Entities.getEntityProperties(this.ParentID, ["color", "intensity","direction"]);

  3. Set the field “user data” of the terrain to:
    { "ProceduralEntity":{ "shaderUrl":"<url>", "uniforms":{ "sunColor":sunProperty.color, "sunIntensity":sunProperty.intensity, "sunDirection":sunProperty.direction }, } }