Reply
Reply
 
Thread Tools Display Modes
MrOneTwo's Avatar
Old (#1)
So I'm trying to make grass from 3d motive tutorial. After lots of messing with coord system I finally made it work... kinda... I don't know why but they are rendered with vertex colour. I painted the terrain with detail painting. If I change the tint colour of grass in the terrain settings only the value changes anything and it changes 'opacity' of vertex colours. I painted mesh with red like in tutorial so I could make it move depending on vertex colour. Any one knows how to fix it ? Any idea how to make it move with vertex colour ? ;p (I just didn't google it yet. Maybe some one here did something like that ?)
Offline , polygon, 576 Posts, Join Date Mar 2011,  
   Reply With Quote

Elyaradine's Avatar
Old (#2)
I'm unfamiliar with the tutorial, but you should definitely be able to animate the grass in the vertex shader according to vertex colour, if that's what you're after.

Although, all of the grass vertex animations I've seen use the UVs to control which parts of the grass are affected, and you could probably use your vertex colours to control the direction or something. Could be pretty cool.

If you haven't written such a shader before, I think that a similar shader is included in the built-in shader source (although those might be using Shaderlab, rather than the more standard -- and more understandable in my opinion -- standard vertex and fragment shaders).

If you get really stuck I can look at whipping one up when I've got some time.
Generalist and TA at Luma Arcade
Houdini/Mixamo entry
Offline , triangle, 287 Posts, Join Date Apr 2009, Location South Africa  
   Reply With Quote

MrOneTwo's Avatar
Old (#3)
Thx! I will try to do it. I never messed with the shaders code though. Must ...useeee....my.... brains! Since when You paint terrain with detail mesh it responds to wind (making this wavy movement) it should be possible. Still have the vertex paint issue though :/ The tutorial uses red channel of vertex paint to move grass. The part closest to ground is black and as it goes up its brighter red. Having this you can make upper parts move more than those near the ground.... my problem is that Unity keeps showing vertex paint when I paint with detail mesh. I found out that only detail mesh painting makes sense with creating grass since it lets you easliy control the density. I could delete vertex colours and maybe use built in responsivness on wind but I would like to have more control over it. First I need to solve this vertex paint issue.
Offline , polygon, 576 Posts, Join Date Mar 2011,  
   Reply With Quote

Elyaradine's Avatar
Old (#4)
Wait, you can do vertex painting from within Unity?

I... have never done that, but it would be pretty handy if I could do that on non-terrain objects too... I'll have to check that out!

Whether you're using vertex colours, or UVs, and what they do, is really dependent on how the shader is written. If you're not getting the result you're looking for, I think there's a good chance the shader's just expecting different information to what you're providing. Maybe posting the shader code could help.
Generalist and TA at Luma Arcade
Houdini/Mixamo entry
Offline , triangle, 287 Posts, Join Date Apr 2009, Location South Africa  
   Reply With Quote

MrOneTwo's Avatar
Old (#5)
I'm not writing the shader yet ;] Problem with vertex colours is :

- I painted vertices in max
- imported as fbx to unity
- painted terrain with detail mesh painting
- all detail mesh is tinted with vertex colours ( == grass is red ;])

As far as I know there is a plugin for Unity to vertex paint but I wasn't talking about it ;p I'm sorry if its hard to understand me sometimes. My eng is bit rusty.

I will try to write the shader when I'm done with this issue ;p

Thats how it looks.

Offline , polygon, 576 Posts, Join Date Mar 2011,  
   Reply With Quote

Elyaradine's Avatar
Old (#6)
Ah, okay.

What you see in your Unity scene is what your shader gives you. If your vertex colours are influencing the output in your shader, that's what you'll see. If you switch the grass to use another material and a different shader (say, ordinary diffuse for example), you probably won't see the red any more -- but then you'll probably lose your grass blowing animation too.

Does that make sense?
Generalist and TA at Luma Arcade
Houdini/Mixamo entry
Offline , triangle, 287 Posts, Join Date Apr 2009, Location South Africa  
   Reply With Quote

MrOneTwo's Avatar
Old (#7)
Even If I change material the vertex colour shows up. Maybe its mesh detail thingy that it uses vertex colours (always).
Offline , polygon, 576 Posts, Join Date Mar 2011,  
   Reply With Quote

Elyaradine's Avatar
Old (#8)
Ah. I haven't worked with the Terrain engine, as it's not supported on mobile. :/
Generalist and TA at Luma Arcade
Houdini/Mixamo entry
Offline , triangle, 287 Posts, Join Date Apr 2009, Location South Africa  
   Reply With Quote

MrOneTwo's Avatar
Old (#9)
Maybe I shouldn't use terrain properties since I want to try to sell those in asset store... people making mobile games could use them better then.
Offline , polygon, 576 Posts, Join Date Mar 2011,  
   Reply With Quote

ultramedia's Avatar
Old (#10)
IT'S THE RED WEED FROM MARS!!1!
Offline , spline, 120 Posts, Join Date Feb 2007,  
   Reply With Quote

Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Copyright 1998-2012 A. Risch