1
0
Fork 0
fgdata/Effects/tree.eff
timoore ffa9cae11c New tree rendering algorithm
Draw trees in two passes, opaque and transparent. This allows us to
have some transparency, which is better looking, and dispense with
sorting.


Author: Tim Moore <timoore@redhat.com>
2009-11-23 21:53:56 +00:00

99 lines
3.1 KiB
XML

<?xml version="1.0" encoding="utf-8"?>
<!-- Effects files for trees, which are placed by a shader. -->
<!-- Trees are drawn in two passes. The first draws the opaque parts
with z writes enabled. The second draws the the transparent bits
with z testing enabled and z writes disabled. The transparent
tree silhouettes will blend correctly against the opaque
geometry. They may cause artifacts when blending against other
edges, but the overall "forest" is supposed to be nice and
fuzzy. There might also be artifacts when blending over other
transparent objects, but that's mostly unavoidable.
Note: no sorting needed! -->
<PropertyList>
<name>Effects/tree</name>
<parameters>
<texture n ="0">
</texture>
</parameters>
<technique n="10">
<predicate>
<and>
<property>/sim/rendering/shader-effects</property>
<less-equal>
<value type="float">1.0</value>
<shader-language/>
</less-equal>
</and>
</predicate>
<pass n="0">
<lighting>true</lighting>
<material>
<ambient type="vec4d">1.0 1.0 1.0 1.0</ambient>
<diffuse type="vec4d">1.0 1.0 1.0 1.0</diffuse>
<color-mode>off</color-mode>
</material>
<alpha-test>
<comparison>gequal</comparison>
<reference type="float">1.0</reference>
</alpha-test>
<texture-unit>
<unit>0</unit>
<type>2d</type>
<image><use>texture[0]/image</use></image>
<wrap-s>clamp</wrap-s>
<wrap-t>clamp</wrap-t>
</texture-unit>
<program>
<vertex-shader>Shaders/tree.vert</vertex-shader>
<fragment-shader>Shaders/tree.frag</fragment-shader>
</program>
<uniform>
<name>baseTexture</name>
<type>sampler-2d</type>
<value type="int">0</value>
</uniform>
</pass>
<pass n="1">
<lighting>true</lighting>
<material>
<ambient type="vec4d">1.0 1.0 1.0 1.0</ambient>
<diffuse type="vec4d">1.0 1.0 1.0 1.0</diffuse>
<color-mode>off</color-mode>
</material>
<render-bin>
<bin-number>2</bin-number> <!-- RANDOM_OBJECTS_BIN -->
<bin-name>RenderBin</bin-name>
</render-bin>
<alpha-test>
<comparison>less</comparison>
<!-- <reference type="float">0.33</reference> -->
<reference type="float">1.0</reference>
</alpha-test>
<blend>
<source>src-alpha</source>
<destination>one-minus-src-alpha</destination>
</blend>
<depth>
<write-mask>false</write-mask>
</depth>
<texture-unit>
<unit>0</unit>
<type>2d</type>
<image><use>texture[0]/image</use></image>
<wrap-s>clamp</wrap-s>
<wrap-t>clamp</wrap-t>
</texture-unit>
<program>
<vertex-shader>Shaders/tree.vert</vertex-shader>
<fragment-shader>Shaders/tree.frag</fragment-shader>
</program>
<uniform>
<name>baseTexture</name>
<type>sampler-2d</type>
<value type="int">0</value>
</uniform>
</pass>
</technique>
</PropertyList>