Hi everyone. I’m brand new to Krakatoa and I have what I’m sure is a pretty newbie question. I’m trying to get the individual splines of the PRT Hair to sample the texture color found at he root of the hair. Basically, I’m trying to get an accurate representation of a leopard skin pattern to be reflected in the PRT Hair. I followed the procedure Bobo described in the “Krakatoa MX 2 Hair Rendering And Magma 2 - Part 3” webinar, but I think I must be doing something wrong. It does seem to be sampling the texture, but not according to the way it is laid out in the geo UVs. I’ve tried everything I can think of to fix it, so any advice would be much appreciated. Thanks!
Sorry. I forgot to mention that I’m using the Max Hair and Fur modifier.
Hi!
The FaceQuery operator should be set to query the TextureCoord channel, or MappingX channel (where X is between 2 and 99 to access UV channels 2 to 99).
Right now, you are asking for the Position of the HairRoot according to the FaceQuery, which will be equivalent to the HairRoot itself because it IS on the surface point. But you have a 2D texture and you want the UVs at that point instead!
Hope this helps…
Hi Bobo. Thanks for the quick reply!
Sorry, I don’t understand. I’m brand new to MagmaFlow and am not yet familiar with the way these nodes work. Could you please be more specific? Paraphrasing Steve Carell, " You just explained it to me like I’m a 10 year old, now explain it to me like I’m a 5 year old".
Thanks
Well then!
A long time ago, in a Magma flow far far away, there lived an operator called FaceQuery. When he was born, he was so poor he only had a Position output. But his mother called over the fairy godmother and she granted him a drop-down list with all mesh channels in the kingdom! So when he wanted to know the mapping of the point he was standing on, he would just select “TextureCoord” from his list and a wondrous thing would happen - a new Output socket would magically appear on his shoulder and tell him the exact mapping coordinate! And so he lived and evaluated every particle in the land happily ever after!
In short,
*Select the FaceQuery operator
*Click in the drop-down list and scroll down to the end to find the TextureCoord channel name. Select it and then press the Add… button - a new Output socket will appear in the Exposed Mesh Channels list, and on the node itself.
*Now uncheck the “>Expose Position” checkbutton and the new output will become the first output and remain connected to the same node as the Position was before.
At this point, the FaceQuery should produce the mapping coordinate needed by the InputTexmap operator to get the right texel.
Ha ha! Now the only thing FaceQuery is missing is a dropdown menu for Candy! Thanks for the simplified explanation, Bobo. I was getting worried because I think we all know what it’s like to try to explain things to a 2 year old
This is definitely on the right track, but as you can see there is some stretching. I checked my UVs, explicit mapping and otherwise clean…
Is there a chance your mesh has multiple mapping coords and you are using the wrong one?
Just to be sure, take a GeoSphere, add Hair, add the same Magma and see if the colors on the surface match the colors on the hair. A GeoSphere has only Mapping Channel 1 by default (TextureCoord in Magma). I just tested here and it works as expected.
Btw, another way to achieve the same effect is to remove the InputTexture and pipe out the TextureCoord of FaceQuery into a TextureCoord Output node. Then assign the original material of the mesh to the PRT Hair. It should produce the exact same result.
Sorry, my mistake. I have the main mesh broken up into separate pieces with different Hair and Fur modifiers applied to each of them. I was only sampling one of them in the InputGeometry node when I made that render. That’s where the apparent stretching was coming from. I added the other meshes and now it looks right. My apologies for leading you on a wild goose chase! By the way, I’m using multiple Hair and Fur modifiers in order to get an appropriate resolution for this character. Just one applied to the whole body makes him look like a porcupine! Plus, the Hair and Fur modifier doesn’t look very good scaled. I wish there was another way that was more direct…
In its current form, it seems that only one PRT Hair can be used per scene if you are using Max’s Hair and Fur mod. Is that correct? Is there a way to do a scene of, say, a blonde woman wearing a (fake) leopard fur jacket and be able to render both of them together? Right now my solution has been to render each PRT Hair mod separately, turning off the ones I don’t need, and then comping the results later. Is there a better way to do that?
Also, in another post you said “There is no hair, only particles”. So if splines have no thickness, and particles have no thickness, where does the apparent thickness of the hair strands come from? I know how to use the falloff curve to control the tapering toward the ends, but what determines the initial diameter of each hair, and can that be controlled?
I will try the other setup you mentioned as well! Magma is one powerful tool, but it takes a while to get the hang of it. Thanks for all your help. Bobo!
This is a limitation of the Hair&Fur SDK - what PRT Hair does is call a function which writes out ALL the hair from the scene to a special file (which Joe Alter implemented and that can only be exported for the whole scene, not per object). PRT Hair then parses that temp. file, reads the splines from it and creates the particles. It is a total hack, but it is better than nothing.
For all other Hair sources (HairFarm, Ornatrix, custom Splines), you can pick an individual object as the source, so you create multiple PRT Hair objects in one scene and control them individually.
In rare cases (single images) where dynamics are not important, you can also snapshot a Hair&Fur to an EditableSpline and create a PRT Hair from that.
There is a better approach - you can enable Hair on one object and dump the resulting particles to a PRT sequence. Then disable that, enable another and dump to another PRT sequence. Then load in multiple PRT Loaders and apply the Magmas on the cached data sets for ultimate control. It will also be much faster because no hair generation and hacky export to a temp file will have to be performed for each frame rendered, but at the cost of huge disk space usage.
Krakatoa is a volumetric particle renderer. In point (particle) mode, it draws each particle as a pixel-sized point according to the Density channel and the Draw Filter settings. The Density of the particle is remapped to the volume that the pixels the particle occupies cover in world space. As the Density gets lower, the contribution of a particle to a pixel will get less, too. When the Density is very low, the particle might become completely invisible. We employ this fact to simulate apparent thickness change by varying the particle Density channel from root to tip. As with Anti-Aliasing, diminishing RGB intensity and Alpha in adjacent pixels is perceived by the brain as reduced coverage. So to your eye/brain, falling off Density appears as a strand actually getting thinner and covering less and less of the pixels.
In other words, a Krakatoa Hair cannot be thicker than the number of pixels a typical particle with high Density would cover according to the current Filter settings, and can fall down to 0.0 thickness as the Density falls down to 0.0. For that reason, selecting the final resolution early on is important to determine the look and number of hairs needed to make the final result look right.
Hope this helps.
I just used the PRT sequence approach and it worked like a charm! It didn’t take up much disk space either since I was only doing a single frame. I also tried the other Magma strategy you mentioned by deleting the InputTexture node and applying the material to the PRT Hair itself, and that worked too. I will have to think about what the advantages would be doing it one way or the other.
Thanks also for the explanation of particle density. I found out pretty quickly that setting the correct scale with the Max Hair and Fur mod is really important to getting the right look. I will probably have a few more questions regarding PRT Hair use with splines at some point, but I don’t want to wear out my welcome. I really appreciate you taking the time to thoughtfully respond to my questions, Bobo!
Cheers, from Seattle!