PDA

View Full Version : Bake vertexcolors to objectsequence



Daniel Collin
03-27-2014, 11:43 AM
Hi,

I would iike to bake vertexcolors to an object sequence where each mesh should gets its own unique lighting. When testing this it doesn't seem to work at all.
So my other plan was to just do a small python script that would load the mesh, render a frame, save the mesh, remove the mesh, repeat for next mesh: A simple version is like this (for one mesh)

result = ga.evaluate(ga.data, "LoadObject MyMesh_0000.lwo")
result = ga.evaluate(ga.data, "RenderFrame")
result = ga.evaluate(ga.data, "SaveObject MyMesh_0000_2.lwo")

Problem here is that the mesh loads and renders fine, it gets save to disk but the lighting isn't applied in the vertexcolor map (if I render the frame manually (pressing F9) and then save the mesh it works fine, but doing this for many meshes would be very tedious so I would like to automate the processes somehow)

Any ideas on how to do this?

Cheers!

ernpchan
03-27-2014, 02:56 PM
Does using RenderSelected provide different results?

Daniel Collin
03-27-2014, 03:00 PM
Does using RenderSelected provide different results?

Gives the same result :/ I almost think that its a "race condition" here. Meaning that RenderFrame is being started (in the background) and at the same time the mesh is being save and the save complete before the rendering is done. This is of course just a theory though.

ernpchan
03-27-2014, 05:15 PM
Gives the same result :/ I almost think that its a "race condition" here. Meaning that RenderFrame is being started (in the background) and at the same time the mesh is being save and the save complete before the rendering is done. This is of course just a theory though.

Submit a bug report.

Sensei
03-27-2014, 05:37 PM
When testing this it doesn't seem to work at all.

It doesn't work, because unfortunately to be honest you have no idea what you're doing...

Vertex Color Map (that can be read in Node Editor using Vertex Map > Vertex Color node) has never ever colors from lights at any stage of rendering or data processing. It has always colors that you set using Set Map Value or similar Modeler tool.

You would need UV Map (Atlas might be).
Then a way to globally turn off all textures, specularity, reflection and refractions etc. etc. so just lights would influence result.
Then render mesh like would would bake textures (Batch Baking Camera or Surface Baking Camera).
Then load mesh in Modeler, and use VMapManager from TrueArt's Modeling Pack http://modelingpack.trueart.eu and use LoadVMapImage tool to load saved in previous stage image map to Color Map. Essential: UV Map must be picked the same as while baking.
After that you have Vertex Color Map with lighting taken from baked image.

Daniel Collin
03-27-2014, 11:32 PM
It doesn't work, because unfortunately to be honest you have no idea what you're doing...

Vertex Color Map (that can be read in Node Editor using Vertex Map > Vertex Color node) has never ever colors from lights at any stage of rendering or data processing. It has always colors that you set using Set Map Value or similar Modeler tool.

You would need UV Map (Atlas might be).
Then a way to globally turn off all textures, specularity, reflection and refractions etc. etc. so just lights would influence result.
Then render mesh like would would bake textures (Batch Baking Camera or Surface Baking Camera).
Then load mesh in Modeler, and use VMapManager from TrueArt's Modeling Pack http://modelingpack.trueart.eu and use LoadVMapImage tool to load saved in previous stage image map to Color Map. Essential: UV Map must be picked the same as while baking.
After that you have Vertex Color Map with lighting taken from baked image.

Im not sure what you mean. I use Surface Baking as a Shader on mesh and select that it should bake to Object and this certainly works just fine if I do everything manually. What I want to do is to automate the process for x number of meshes without repeating all the steps manually (either using an object sequence (which doesn't seem to work)) or some other way.

Sensei
03-27-2014, 11:44 PM
Check out BatchBakingCamera
http://batchbakingcamera.trueart.eu
It doesn't require to pick up object and uv map from drop-down list like Surface Baking Camera does.
But it's baking to image map, which has much more resolution than just color map.

Why are you needed color map?
Surface Baker shader require using 1 thread, and all rest (7-11) are idle, so baking might be 1200% faster just because of it..
I thought so nobody is still using Surface Baker shader, as it's obsolete..

So what you actually need is a way to spread Surface Baker shader to multiple objects/surfaces.

Daniel Collin
03-28-2014, 01:53 AM
Check out BatchBakingCamera
http://batchbakingcamera.trueart.eu
It doesn't require to pick up object and uv map from drop-down list like Surface Baking Camera does.
But it's baking to image map, which has much more resolution than just color map.

Why are you needed color map?
Surface Baker shader require using 1 thread, and all rest (7-11) are idle, so baking might be 1200% faster just because of it..
I thought so nobody is still using Surface Baker shader, as it's obsolete..

So what you actually need is a way to spread Surface Baker shader to multiple objects/surfaces.

The reason why I want to use a vertexcolor map is that is going to be used in real-time on low-end graphics hardware (as pre-baked vertex lighting for an animation) I can of course bake to image maps and then just write some code that samples the image at each vertex/uv position but it seems unneeded to do it as Lightwave (almost) can do what I want.

The fact that its only using 1 thread doesn't matter much as the geometry is quite low-res anyway.

Daniel Collin
03-28-2014, 01:37 PM
I managed to work-around the problem by writing a plugin that makes the process a bit less manual at least.

Thanks for the replies!