- Home /
prelighting using vertex color
I have been prelighting the static parts of my scenes in MAYA for years (some call it 'baking the lights', and having that as the sole lighting for static objects in the engine. On the DS this looks exactly like it does in maya, with "use no lights" selected. (I use dynamic lights only on moving meshes)
In Unity, I am having problems getting the same effect. With no lights in the scene, the color parts show up, but not the brightness.
Please note I am using the "vertex color" shader from the forums.
(Specifically, I have light spilling in a window. I use vertex coloring to darken my floor, and brighten a wedge to mimic the effects of a sunbeam. In Unity I see the colors but they don't seem to 'glow'. I am not using illumination maps. If I need to screen capture an example I can.)
Any ideas how to get my prelighting (baked into the verts) into unity so it mimics exactly what I see in maya?
Yes, it would probably help if you could supply a screenshot of what you expect it to look like (perhaps from $$anonymous$$aya), and a screenshot of what you're seeing in unity.
Will try suggestions and include screenshots if I am still 'stuck'
Answer by duck · Feb 19, 2010 at 05:44 PM
Without knowing which shader specifically you're using, it's difficult to tell - but it sounds a little like it could be that the shader you're using is multiplying at a 1x level, so that it only has the effect of darkening the diffuse texture colour, and a full-white value would leave the diffuse texture at its normal 100% level.
Wheras it may be that you're used to shaders which "double multiply" the value, so that a mid-grey value leaves the diffuse texture at its normal level, wheras a fully-white value has the effect of multiplying the colour values by 2 (in effect lightening those areas where the vertex colour is lighter than mid-grey).
You could check this by having a look in your shader source.
If your shader combine says only:
Combine texture * primary
rather than:
Combine texture * primary DOUBLE
then this is probably the case, and you can probably fix it by adding the 'DOUBLE' keyword. There's also the 'QUAD' keyword, in case you want 4x brightening instead of 2x!
Yeah, I figured the lack of "glow" you mentioned was the inability to get overblown highlights. I linked to Eric's shader because his uses Double. Unity's builtin lightmap shaders do not. Nothing that I know of uses Quad, but feel free!
Thank you I will try it this week. Really appreciate the advice.
both answers combined got me what i need, so thanks. I am only allowed to "checkmark" one as correct. But really both helped considerably.
Answer by Jessy · Feb 18, 2010 at 11:26 PM
I don't know what the "vertex color shader from the forums is", nor do I know what "the color parts show up, but not the brightness" means, but Eric Haines (Eric5h5) added the simplest possible shader that uses a vertex color "lightmap", to the wiki. Is that what you're looking for?
Checking this out too... looks like it should help. Deep thanks.
both answers combined got me what i need, so thanks. I am only allowed to "checkmark" one as correct. But really both helped considerably.
Your answer
Follow this Question
Related Questions
Is there a bug in Mobile/Transparent/Vertex Color shader 0 Answers
Incorrect transparent rendering 2 Answers
Multiple light baked textures for one mesh/model? 0 Answers
progressive lightmapper not reach 100% CPU 0 Answers
Weird dark spots when baking light 1 Answer