vegetation shader using vertex colors to control bending

hi there,

here is a preview of my latest progress of porting the tree creator shaders so you can use them on any imported model providing vertex colors to control overall bending and edge fluttering.

webplayer version 3:
translucency now working even in deferred mode:
http://bit.ly/H7KeGR

webplayer version 2:
http://bit.ly/GzvYFU

update 01
you can now switch between forward (nicer lighting) and deferred rendering and change the sun’s position.
the shader supports bumpmapping, translucency (forward rendering only) and specular lighting – all working even on models placed within the terrain engine.

update 02
i made 2 shaders for trees: bark and leaves (including the billboard shaders) and roughly set them up. the webplayer shows now even some trees (@janpec…). thoose were modeled using the tree creator then exported as object (you don’t have to do so: you can do it all by hand). unfortunately the model got a little bit corrupted, but anyway. all the vertexpainting was done by hand using modo – which is quite a job. but i only spent some minutes on it so bending is not at its best…
you can compare the original tree creator shaders and my ones as the most right tree marked with a small white cube is the original one using the original shaders. the imported models don’t have any ambient occlusion baked to vertex color. they also just support a very simple lighting model in deferred rendering mode. switching to forward rendering there is practically no difference as far as lighting is concerned.
webplayer version 2: http://bit.ly/GzvYFU

update 03
well, i guess this is it! the shader now supports bump mapping, specular lighting, translucency and baked ambient occlusion both in forward rendering and deferred rendering mode – just like the built in tree creator leave shader. but unlike the built in shader bending is fully controlled via vertex.colors.rgb (edge flutter, branch phase, primary and secondary bending) – no second uv set is needed.
additionally the custom bending function makes look the distortion much more different on each game object so you will get much more variety. just compare the two shaders in action by testing the webplayer version 3: http://bit.ly/H7KeGR

Very nice!

the webplayer shows 2 different sorts of plants planted in 2 different ways: all plants casting shadows are planted manually as game objects, all ferns not casting shadows are planted within the terrain engine rendered as meshes (using the hacked vertexlit shader). as all game objects can be batched they are pretty cheap to render: 3 draw calls for all manually planted ferns, 3 draw calls for all flowers (using real time shadows –*otherwise it would be just 1 draw call…).
the shader does not support the built in wind zones but can be controlled via scripting.

lars

Larsbertram, very nice work defenetly very usefull. Now i have one question…does that means that you could also model tall trees and use them with this shader, or does it only works with low plants? Really looking forward for that answer, becouse custom tree shader is a must for current terrain engine.

you can use the shader on any game objects –*including tall trees.

This sounds too good to be true. I really need to test this. Are you going to sell this shader on asset store?

i will publish it for free – like all other shaders from the ats package.
but as far as trees are concerned: you will have to setup bending using vertex colors –*which is quite a job to do manually on such a complex model like a tree.
if i were a programmer i would rather write a script to automatically setup trees with vertex colors. unfortunately i am not…

and of course: in order to use the shader with trees you will have to update the lighting function.

lars

very impressive! Do they work quickly on mobile in general or is it a relatively expensive operation?

Could you explain little more what does that mean? If i am guessing correctly, this means that AO doesnt work with your shader correct?

Tree bending with vertex colors is the smallest problem, there are some very nice tutorials in Cryengine SDK for tree bending with vertex colors.

the shader is based on the cryengine/unity tree creator shader as far as its bending function is concerned, so i guess it will not be the cheapest one (iphone…? hippocoder?)

@janpec: right now it includes my own lighting function (optimized for rather small plants) and does not support bump mapping, specular lighting or translucency for i always wanted to have a shader which i could use for game objects as well as for meshes placed within the terrain engine, which just supports diffuse and alpha textures. i have figured out a way to provide more than just those 2 textures to the terrain engine, but the way to do so is a rather complicate one: you will have to built your own texture atlas…

ao baking to vertex alpha is not supported right now – but it is no shader feature at all: if you bake ao to vertex alpha it should not be any problem to look it up within the shader.

basicly the shader gives you all the possibilities you have right know using the built in tree creator shaders.

lars

so this shader will be bundled with ATS v2?

webplayer updated, have a look at the first post.

Ah too bad to hear that about no normals and speculars, hopefully some day you will maybe figure it out and hack those two maps too.

@janpec: bumpmapping and specular lighting are supported – both in forward and deferred rendering mode.
just translucency is only works in forward rendering mode…

Oh ok good to know that, i will defenetly give a try to shader then, it doesnt matter if transulency works for forward rendering only, deferend mode in Unity is useless with shadows, so i am looking for forward rendering more or less. When do you plan to release shader?

Hotness.

new update: read the first post!

This is a nice addition. I’m already using your ATS v2 in my current project for my terrains.

After seeing Killstar Tropical plants pack i just realised that i didnt completly understand that this shader actually allows you produce exactly the same quallity of plants that Cryengine or UDK support at the momment. I have run trough demo you provided too quick the first time seeing it. This is the most important feature i have wanted for future games, even DX11 features cant cope with this shader. I dont know why this thread hasnt got more attention, it certainly deserves it. I will certainly bump it with every plant i model.

Wow those plants look incredible, definitely on the same level as anything from the UDK or Cryengine, good work sir!