Select to view content in your preferred language

Animated Water Shader in WebScene

7036
12
07-15-2013 01:29 AM
MatthiasBuehler1
Frequent Contributor II
[docs provided by Andreas Ulmer ]


Hi all,

some additional hints on the water shader in CityEngine Web Viewer:

the following substrings trigger the water shader in Web Viewer:
<something>__water<something> (default wave params)
<something>__waterquiet<something> (slower wave speed, less amplitude)
<something> __waterstormy<something> (higher wave speed, more amplitude)

e.g.
"myShape__water"
"myLayer__waterstormy"

these strings can be set either on a shape name or a layer name. When set on a layer, all objects in this layer will get the water shader.
When setting the substring to shape names the export settings of these shapes need to be set to interactivity: pickable for the Web Viewer to pick it up.
When set on a layername, the __water* substring will be removed from the layer name displayed in Web Viewer.


when using CGA the water material can be specified using the substring "__waterparams" in material name:
set(material.name, <something>__waterparams_<wavesize>_<wavespeed>)
set(material.name, "watermaterial__waterparams_2_5")
set(material.name, "watermaterial__waterparams_5.5_10.2")
avoid params with more than one number after the dot (e.g. don't set "waterparams_5.50_10.21")

the values used for the __water* strings above:
__water: wavesize: 7, speed: 10
__waterquiet: wavesize: 2, speed: 5
__waterstormy: wavesize: 15, speed: 30
Tags (3)
12 Replies
by Anonymous User
Not applicable

Put this attribute:

attr WaterColor = "#000000"

Then put this in the rule:

color(WaterColor)

Then set your brown color in the inspector.

Chris

Sent from my eyePhone

0 Kudos
KathrynAngleton
New Contributor III

I digitized the river (it's a very small scene) in CE via polygon shape creation. Since it wasn't a shapefile, how do I add an attribute to it? Would I add the water color code to an already existing rule file or do I make a new rule file that uses just that code?

0 Kudos
KathrynAngleton
New Contributor III

Never mind, I figured it out. I had a slow moment, haha.

0 Kudos