You can use ay float texture as displacement map, for instance:
- Code: Select all
Texture "displace_map" "float" "fbm" "integer octaves" [8] "float roughness" [0.500000] "vector scale" [0.100000 0.100000 0.100000] "vector rotate" [0 0 0] "vector translate" [0 0 0]
AttributeBegin
Transform [1.0 0.0 0.0 0.0 0.0 1.0 0.0 0.0 0.0 0.0 1.0 0.0 0.74215400219 -0.382443904877 0.0311622619629 1.0]
NamedMaterial "mat_sphere"
Shape "loopsubdiv"
"integer nlevels" [6]
"string displacementmap" ["displace_map"]
"float dmscale" [0.25]
"integer indices" [
0 1 2
[...]
where:
- nlevels is the number of time each triangle must be subdivided;
- displacementmap is the name of a float texture;
- dmscale is a scale factor for the displacement map;
- indices, P are the same parameter of a trianglemesh (it is trivial to transform a trianglemesh in a loopsubdiv: just add the "nlevel" parameter).
Now some demo of this feature. The first image is an FBM texture applied as color (left) and applied as displacement map (right):
And the same for the Dots texture:
Indeed, I couldn't resist
Loopsubdiv shade doesn't support UV coords and it is the next thing I'm going to add.
As usual, it is the first implementation, your mileage can vary.
