misterbil Posted September 11, 2015 Share Posted September 11, 2015 Hello everyone, I've seen a couple of post about this but not exactly what I'm looking for. A little background on what I'm trying to do. I'm trying to export a 2d image of a fluid to animate the UV coordinate of an texture in a game material ... not super clear I know, these guys might explain it better : http://www.valvesoft...s_waterflow.pdf This way I can add detailed motion to a sprite with only 2 textures, and not use ginormous sequence of animation. But in Valve instance they "paint" their texture to add flow motion to a river or pond. I would like to generate that image procedurally with a fluid for FX work. right now here is what I do: - have a fluid animation that I like -cache it -DOPI/O all the info I need back into SOP -use a Point VOP -use the velocity info to color points on a grid -render that grid but my problem is that the velocity field is (naturally) all over the fluid container, so I was wondering how can I use my density field as a "mask" for my velocity? In VOP, saying something like where my density is zero, set my velocity to zero, ... make any sense? In the 2 images attached you can see how it works. when a pixel is 50% red, 50% green and 0% blue no motion. 100% red, 0% in G and B pixel are moving south west ...etc. The flow test images show you what I have, so you can see that I have no motion (R=50%, G=50%, B=0)outside the container, but inside I have motion all over.... And last an image of the density field.... where I want my motion. so can I use density to "mask" out my velocity? any help or question would be really appreciated. flowmap_test.hip Quote Link to comment Share on other sites More sharing options...
loudsubs Posted September 11, 2015 Share Posted September 11, 2015 You can use the volume sample VOP to check volume properties according the point's position. Here I check if density = 0. If it is I set vel to 0, if not then let vel pass thru. Then get the length of each vel vector, normalize it, and drive a color ramp. Here's 2 ways. Just be aware of the primitive number of each volume, when using the volume sample VOP (middle mouse or geometry spreadsheet to check). flowmap_test_ac.hip Quote Link to comment Share on other sites More sharing options...
misterbil Posted September 12, 2015 Author Share Posted September 12, 2015 Hi Loudsubs, thanks a lot for your reply! This seems like a good idea. Unfortunately I don't think this is what I'm looking for. Or at least I'm not able to get it to work. When I open your file and render an image I get, what it looks like, a single float value per point. and it is not "masked" out by the density. at least it doesn't look like it. What I'm trying to get is that if the velocity goes positive Y it get greener, (Y axe on the diagram I posted first). and redder for velocity X I'm also experimenting with Volume mix node to try to mask . maybe I can advect a bunch particles and have them change color based on their velocity... I'll try that this week end thanks a lot anyway. cheers Quote Link to comment Share on other sites More sharing options...
breadbox Posted May 21, 2016 Share Posted May 21, 2016 I am looking to do something similar as well. I know how to render the vectors, but was wondering how to create them. This video looks interesting where the artist "comb" the normals and then the flow field simulates from that. but how does the flow field simulate? He does not show the entire network to see what causes the flow simulation? Quote Link to comment Share on other sites More sharing options...
misterbil Posted May 23, 2016 Author Share Posted May 23, 2016 Based on the comment under his video, it look like he is doing the same thing as in games. I'm guessing a shader trick to blend between the original texture and the "distorted" images. going between 0 to 1 to 0 to 1 to 0.... The comb the normal set up is an idea developed at Valve if I remember well, you can find the pdf with the full network/tutorial online. I'll try to find it and post it here. I also need to update my previous post (on this thread ) as I found better results. Just been so damn busy Quote Link to comment Share on other sites More sharing options...
Airship Posted May 26, 2016 Share Posted May 26, 2016 Hey all - Hope your day is going well. I dug into the flow map thing a while back and came up with an absurdly and unnecessarily complex solution that you can see here: But it's cumbersome and complicated and difficult to use in a real production (games) environment as we found out. If someone wants the .hip, hit me up but I'm seriously embarrassed to post it here because it's a bit of a mess. After reading this thread, I put together a simpler version that works with either fluid sims or "painting" (combing normals). The top image is from the painting method, and the bottom is from the fluid sim. Hope that's helpful. Best, Ewan flowmap_baker_airship.hip Quote Link to comment Share on other sites More sharing options...
misterbil Posted May 26, 2016 Author Share Posted May 26, 2016 Hi Airship, that looks pretty sweet though! I'll take a look at your Hip tonight. (Just curious ) But, I was wondering, what made it complicated to use ? Thanks bil Quote Link to comment Share on other sites More sharing options...
Airship Posted May 26, 2016 Share Posted May 26, 2016 Hey Bil - The .hip file I posted here is pretty simple but the previous one in the vimeo video allowed blending between sim and painted velocities that made it slow (especially on massive water plane grids with lots of collision geo) and complicated. We just ended up creating "paint velocity" functionality for water surfaces using the paint tool in our proprietary engine. We also added a similar "use collision geo normals" to push flow away from boats, shorelines, rocks in rivers, etc. which works fine. Cheers, Ewan Quote Link to comment Share on other sites More sharing options...
breadbox Posted May 27, 2016 Share Posted May 27, 2016 Ewan, Your example seems nice and easy, it is pretty simple to the technique I am currently using. What I was wondering is in the above video (mengtaiqi) do you think this is a pyro sim to create the moving flow? I wonder if there is a "non-simulated" way to create the flow? The idea to paint or "comb" the flow is nice, but it doesn't evolve over time I guess you could always blend paint maps. In your more complicated example with the object avoidance, did you just add colliders to the pyro field? Quote Link to comment Share on other sites More sharing options...
Airship Posted May 27, 2016 Share Posted May 27, 2016 Hey bud - So the flow maps themselves just control the motion. Red controls X motion and Green controls Y motion. Red 0 is +X, and Red 255 (1 in Houdini) is -X, Green 0 is -Y, Green 255 is +Y. These maps are typically used in a flowmap shader (for water or smoke for example) and they control the direction of the movement. I haven't made a flowmap shader in Houdini yet (like the baboon video) but now I think I may have to. I use the resultant flowmaps from my tool in a game engine that supports it so that water flows in interesting ways (around rocks, etc.) and smoke in particle FX that evolve over time (flipbook sprite for example). They work by distorting the UVs on two versions of the same image, then fading between them to create the illusion of perpetual motion. Check out that PDF from Valve you posted up top. This guys also provides a good overview: http://graphicsrunner.blogspot.com/2010/08/water-using-flow-maps.html Regarding "pushing away" flow from collision objects, you can just transfer the normals from your collision objects to your grid. So the combed normal method basically allows you point the normals in the direction of the flow you want. So, place any object in your SOP - I find a tube with 32 divisions work well to start so that you have plenty of normal data to work with - then transfer normal attribute from your tube to your combed grid. Play with the transfer conditions (samples, smoothing, etc.) to find the best results. That will point the normals around the collision object away from it. If you want to use a cube, you can subdivide it to get the appropriate normals density. Hope that's helpful. Best, Ewan Quote Link to comment Share on other sites More sharing options...
breadbox Posted May 27, 2016 Share Posted May 27, 2016 Yes, it is precisely the application of the "distorion of the UV map" step that I do not understand, because those authors are using a game engine I am not sure how to correctly apply the flow texture to distort the normal map in Houdini. Is there a way to visualize that in Houdini? would you use a sop solver? good tip about the attribute transfer normal for cheap collision avoidance works well! P.S. It looks like in your setup you are using a camera to render the flowmap... a better way might be to render the color directly from the geo grid itself in a COP network. HIP attached. flowmap_renderCOP.hip Quote Link to comment Share on other sites More sharing options...
Airship Posted May 27, 2016 Share Posted May 27, 2016 Here's your file with the velocity masked by density. Cheers, Ewan flowmap_test_airship.hipnc Quote Link to comment Share on other sites More sharing options...
Airship Posted May 27, 2016 Share Posted May 27, 2016 Oh - you're the man! Thank you for the render COP .hip. Much appreciated. To visualize the motion, I used a pop solver with the grid (and velocity attribute or use painted normals as velocity with z nulled out) as the source (see vimeo video posted above). It's crude but works. I'll post my .hip tomorrow when I'm back at work. I'm intrigued by doing a flowmap shader in houdini. I may dig into that tomorrow if I have some time. Cheers, Ewan Quote Link to comment Share on other sites More sharing options...
breadbox Posted May 27, 2016 Share Posted May 27, 2016 Ah ok, so I did just figure out how to apply the flow map to distort the UV. Using a solver to add the flow direction to the UV direction on every frame then loop UV back in for iterate. That part is making sense now. But I'm not sure about the blending method. I understand why it is necessary, because if you let the flow map run for several hundred frames your texture will progressively skew into oblivion. I suppose you setup 2 flow maps and then potentially do a blend UV back and forth between the two? but it seems like it might be tricky to hide the blend. Quote Link to comment Share on other sites More sharing options...
Airship Posted May 27, 2016 Share Posted May 27, 2016 Sweet! Yeah, take what you have, duplicate it so it so that you have layer A and B, then blend the 2 back and forth and you should be pretty close. The actual nitty gritty of how long for each layer, etc. is in that graphicsrunner link above. Nice work! Quote Link to comment Share on other sites More sharing options...
TheDude Posted May 27, 2016 Share Posted May 27, 2016 It would be nice for the the 2 (or more) maps to have different noise seeds along the same general flow map and then for it to randomly switch between them every iteration. Breadbox you're basically there now I think. If you take what you have for 75 frames, chop off the first 25, and so now you have f1-50 of a flow map. Make this loop (modulus 50 frames), and connect a timeoffset with 25 frames, so its always pulling what your main guy's was 25f ago. Now you can lerp between the main one, and the one thats 25frames offset. Have the lerp hit 1 when 0(main guy) is going to snap and reset, and then have the lerp hit 0 when 1(offset guy) is going to reset. You can set a sin function in the bias with the correct timing or something. Quote Link to comment Share on other sites More sharing options...
misterbil Posted May 30, 2016 Author Share Posted May 30, 2016 @TheDude Peter Quint has a great tutorials about that, look for the flame loop tutorial. I use this technique all the time for my sprites. The problem with plane solution to render, per example, a smoke velocity, is that it will render a slice through the smoke, and not the outside billow and swirls. I can see this technique to work great for rivers and "plane" surfaces. But it doesn't work well for smoke. I think we are all getting close though I'm using the velocity to shade directly my smoke. And trying to get a neutral lighting with all shadows off. I need to test it in Unreal to see how it looks but it's promising. A couple of side notes: -I'm using this to replicate what Klemen Lozar is doing with fumeFX. -and also for huge column of smoke where it would not be efficient to use particles in unreal. PS: I can't believe I didn't know about this and sorry if it's common knowledge, but I just found out that if you want to use Photoshop to comp a premultiplied image, go Layers>matting> remove black matte! thank you guys for the inputs, glad to see some game people here BillowSmoke_v1.hipnc 1 Quote Link to comment Share on other sites More sharing options...
jacktee Posted October 12, 2016 Share Posted October 12, 2016 it is possible to use flow map to drive shader in houdini? Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.