Bobo's Krakatoa+Frost Voxel Help

Become a member of the CGSociety

Connect, Share, and Learn with our Large Growing CG Art Community. It's Free!

THREAD CLOSED
 
Thread Tools Search this Thread Display Modes
Old 08 August 2012   #1
Bobo's Krakatoa+Frost Voxel Help

A previous thread led me to Bobo's tutorial about turning an object into Voxels/Legos using Krakatoa and Frost.

I'm trying to texture an UVW unwrapped object using a bitmap.

If I use Vertex colors, then the colors bleed into one another, like in this example.


That's not what I want. I want solid delineation between colors, like with Donkey Kong from the short film, "Pixels."


If I use the Magma Flow editor, like in Bobo's tutorial, they don't bleed into each other, but it's not quite right either. The texture doesn't map perfectly, and it gets all distorted:



It looks as if the answer lies with in the Magma Flow editor route, but I need help.



How do I hook this up correctly?

Last edited by EricMLevy : 08 August 2012 at 06:32 PM.
 
Old 09 September 2012   #2
The PRT Volume's particles get their color from the channel of the level set, so depending on the size of the voxels, the data there can be very low-res compared to the original mesh. That explains the blurriness.

The correct way to approach this is to sample the Nearest Point of the source mesh and get its UVs using Magma.

Do this:
*Make sure your mesh is using a channel different from TextureCoord (like Mapping2)
*Add a Magma modifier to the PRT Volume (assuming you are using Krakatoa MX 2)
*Press Ctrl+O to add an Output node and set it to Mapping2 channel.
*Press O for Object category and press N for NearestPoint.
*Drag with the mouse from the Geometry socket and release to create an InputGeometry node, pick the mesh.
*Drag with the mouse from the Lookup Point socket and release to create a Position input converted to World Space (assuming the PRT Loader is aligned to the Mesh). If you want the mesh to be on the side, you can switch the Transform node to "FromSpace" and add the mesh as the coordinate space object. Now you can move both and they will still evaluate in each-other's local space...
*Select the NearestPoint operator and press the button "Add Face Query".
*Select the FaceQuery operator, uncheck the >Expose Position and find the Mapping2 channel on the list. Press Add... to expose it.
*Connect the output of the FaceQuery to the Output of the modifier.

At this point, you should have very sharp texture coordinates allowing you to map the exact same texture on the PRT Volume as on the mesh. Note that the higher the mesh resolution, the better it will look on the particles!

But there might still be some blurring between two colors because we are interpolating mapping coordinates and sometimes the texture map tries to produce an intermediate color. To get the Donkey Kong look, you could use the approach from my tutorial, but make sure that you are rounding off the value taken from the bitmap and either setting MtlIndex 0 or 1, nothing else. This way, you will get exactly two colors and no in-betweens. A better approach would be to actually cut the details into the mesh and set the Material IDs of the faces to produce the desired look, then steal the MtlIndex from the mesh onto the particles and assign the Multi-Sub Material to Frost...
__________________
Bobo

Last edited by Bobo : 09 September 2012 at 01:01 AM.
 
Old 09 September 2012   #3
Thanks so much for responding. I'm going to try to work this out now. But I do have one question.

Could you please elaborate on this:
"you could use the approach from my tutorial, but make sure that you are rounding off the value taken from the bitmap and either setting MtlIndex 0 or 1, nothing else."

How do I round off that value? With this method, am I limited to using just 2 colors?

Thanks!

Last edited by EricMLevy : 09 September 2012 at 03:18 AM. Reason: oops.
 
Old 09 September 2012   #4
I get a red node when following Method #1:


What have I done wrong?
 
Old 09 September 2012   #5
Originally Posted by EricMLevy: I get a red node when following Method #1:
What have I done wrong?


See attachment.

You somehow skipped the main step - creating the NearestPoint operator

As for MtlIndex, you can have up to 1000 sub-materials in a MultiMaterial. You will have to somehow color-code the bitmap to MtlIndex corelation, for example use the Red channel > 0 to define MtlIndex 0, Blue channel for 1, Green channel for 2, Red+Green for 3 and so on. Or divide each channel into sub-regions and check if the Red channel is below 0.5 and all others are 0, use MtlIndex 1, if it is above 0.5 use 2 and so on. It is up to you...

I will try to set up another example with Sub-Materials...
Attached Files
File Type: zip FROST_KMX_Mapping_v002.zip (24.6 KB, 22 views)
__________________
Bobo

Last edited by Bobo : 09 September 2012 at 03:54 AM.
 
Old 09 September 2012   #6
Originally Posted by Bobo: I will try to set up another example with Sub-Materials...


Here it is.
I expanded the Magma flow to then evaluate a nested checker map in checker map shader and use the Red color > 0 to define MtlIndex 0 (first sub-material). Otherwise it looks at the Green channel and if it is > 0, it sets MtlIndex to 1, otherwise it looks at the Blue channel and if it is > 0 it sets the MtlIndex to 2, otherwise it sets it to 3. You could add more logical tests to determine what should happen if both Red and Green are > 0 (so yellow color in the bitmap could produce another Sub-Material on Frost).

Once I had the MtlIndex channel defined in Magma, I had to switch Frost to respect that channel in the Material rollout. Then I assigned a Multi/Sub-Material with 5 subs (only the first 3 are used right now) to the Frost, and I got the Red color to produce blue cubes, the green color to produce green cubes and the blue color to produce yellow cubes. Max labels the sub-materials 1,2,3. MtlIndex is 0-based so we used 0,1,2. It works. Note that the blue checkermap part is not shown in the viewport unless you enable Hardware shading in the Material Editor. You can unhide the PRT Volume, it will always show the correct colors.
Attached Files
File Type: zip FROST_KMX_Mapping_MtlIndex_v003.zip (26.3 KB, 16 views)
__________________
Bobo
 
Old 09 September 2012   #7
First of all, THANK YOU for taking the time to answer my questions.
Do you know what this error message from both of your files means?

"ERR: BuildMesh: The scene object for magma Transform node with id: 6 was deleted"
 
Old 09 September 2012   #8
Originally Posted by EricMLevy: First of all, THANK YOU for taking the time to answer my questions.
Do you know what this error message from both of your files means?

"ERR: BuildMesh: The scene object for magma Transform node with id: 6 was deleted"


Node ID 6 is the FromSpace transform which used the InputObject ID 7 pointing at the Cylinder to get its transform and make it possible to keep the mesh and the PRT Volume separated in space while still sampling correctly.

What version of Krakatoa are you running? It is possible that it does not support external InputObject input socket for FromSpace. I think that was added to Genome and then ported back to Krakatoa 2.1.x. So if you are running 2.0.x, it would explain the error...

To fix the problem, either pick the Cylinder001 inside the FromSpace node (there is a pick button in the UI), or switch the node to ToWorld and align the mesh to the PRT Volume again...
__________________
Bobo
 
Old 09 September 2012   #9
ALRIGHT! Now we're getting somewhere! Check this guy out.


I would be crying on the floor without your help. Thank you so much.
I'll try to figure out how to do it with a few more colors, like you suggested.
 
Old 09 September 2012   #10
What do you think is causing this artifacting or 'spillage' on the body?
 
Old 09 September 2012   #11
Originally Posted by EricMLevy: What do you think is causing this artifacting or 'spillage' on the body?


No idea. Are there any seams in the UVs around that area?

What color do you get there if you use the direct color approach instead of MtlIndex? Do those boxes look red, green or a mixture of the two?
If they are pure red, then for some reason the UVs there are seeing the red pixels area and not the green, so you should check the UV unwrapping. Or it could be a glitch in the NearestPoint operator - try tessellating the mesh and see if it affects the problem particles.
If you are getting a mixture of the two colors, it might be possible to work around in Magma.
Let me know...
__________________
Bobo
 
Old 09 September 2012   #12
It is a seam on the UV Map. I'll try what you suggested. Thanks.
 
Old 10 October 2012   #13
I'm back at it with this effect. And back at it with another question.

I was able to extend the functionality of the Magma Map which looks at RGB values, and assigns a Material ID. I got it to work with Yellow, Cyan, and Purple.

Whether I use the 'Nearest Point Method' or the 'RGB Value Method,' I'm still running into the same problem, where certain seams and areas bleed into one another.

Even if I pump up the amount of particles, there are still seams of the incorrect color along certain UVs. I'm using a simple model, and the UVs are laid out well.

You mentioned a method that might be more accurate, where the model was cut up into Material IDs. I've done this to my model, but I can't figure out how to get that information into Frost.

Your continuing help would be hugely appreciated.
 
Old 10 October 2012   #14
Originally Posted by EricMLevy: You mentioned a method that might be more accurate, where the model was cut up into Material IDs. I've done this to my model, but I can't figure out how to get that information into Frost.


In the MagmaFlow, change the FaceQuery operator to look up the MtlIndex channel instead of a mapping channel. Output the resulting value directly into the Output node set to MtlIndex channel. If you assign the same Multi/Sub-Material to the source mesh and Frost, they should match. (I have not tested it here yet, but it should work. If it does not, let me know.)
__________________
Bobo
 
Old 10 October 2012   #15
That worked. Thank you.
 
Thread Closed share thread



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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
CGSociety
Society of Digital Artists
www.cgsociety.org

Powered by vBulletin
Copyright 2000 - 2006,
Jelsoft Enterprises Ltd.
Minimize Ads
Forum Jump
Miscellaneous

All times are GMT. The time now is 07:17 PM.


Powered by vBulletin
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.