Author : Nate Broach


Reply
Reply
 
Thread Tools Display Modes
SirCalalot's Avatar
Old (#51)
Loving the 3-hour bump :P

I'll check this bad-boy out when I get home!
Offline , polycounter, 859 Posts, Join Date Nov 2011, Location Birmingham, UK  
   Reply With Quote

haiddasalami's Avatar
Old (#52)
Nice stuff Mattias! Been slowly working on a Maya version but running into some problems but your source code has been quite useful
WebGL Project - In a state of constant flux so might be down when you check it. Pretty old now.
Junior Technical Artist at Digital Extremes.
Offline , dedicated polycounter, 1,859 Posts, Join Date Nov 2009, Location Toronto  
   Reply With Quote

MaVCArt's Avatar
Old (#53)
http://www.scriptspot.com/3ds-max/sc...ow-map-painter

thanks for the comments guys
and @haiddasalami: glad I could help

I uploaded a new version by the way, capped off the maximum value popping and fiddled with the values a bit to make the brush change color value more quickly.

the production has slowed down a bit due to a freelance assignment i'm working on, but the weekends are still devoted to programming so i'm gonna record a video this weekend, and start ironing out the maxscript code to reduce bugs and make it more user friendly

on the to do list:

.ini file to save the user settings and preferences
images on the brush buttons
working soft circular brush
working normal circular brush
fixing .fx shader (not correct yet, I've just noticed)
recording an introduction video
create a demo in UDK using a painted flow map

after all that, my top priority is to get viewport preview up and running, but i've been running into trouble on that. if anyone has worked with scripted materials, please let me know I could really use some help on that :p
Offline , triangle, 341 Posts, Join Date Aug 2010, Location Belgium Send a message via MSN to MaVCArt Send a message via Skype™ to MaVCArt  
   Reply With Quote

Norman3D's Avatar
Old (#54)
Quote:
Originally Posted by MaVCArt View Post
after all that, my top priority is to get viewport preview up and running, but i've been running into trouble on that. if anyone has worked with scripted materials, please let me know I could really use some help on that :p
I might be able to help you out on that front! Sorry I haven't been around msn lately, hehe. I'll show up this weekend ;)
Great work by the way!
Offline , spline, 153 Posts, Join Date Jan 2008,  
   Reply With Quote

Norman3D's Avatar
Old (#55)
A small preview here:


I also created a new FX file for this.
I noticed that the greenish "neutral" color is quite noisy if you open it in photoshop and increase the contrast.
In the shader I'm adding the flow map to the UV_Coord. So if the neutral color was black, the noise would go away!
Offline , spline, 153 Posts, Join Date Jan 2008,  
   Reply With Quote

mLichy's Avatar
Old (#56)
Awesome!
Offline , polycounter, 1,064 Posts, Join Date May 2008, Location Kirkland, WA Send a message via MSN to mLichy  
   Reply With Quote

Computron's Avatar
Old (#57)
I tried it again, still could not get it to work. I set everything up in the order the help file says and then started to paint. Nothing changes and I never get an option to bake my changes. I am just using a tesselated plane.
Offline , dedicated polycounter, 1,451 Posts, Join Date May 2011, Location Minnesota, USA  
   Reply With Quote

MaVCArt's Avatar
Old (#58)
in the version that is uploaded at the moment, viewport preview doesn't work yet, so you still have to use the 2D preview in the script window i'm afraid enable the "enable 2D preview" button if you want to see something

however, as soon as I manage to finish the video i'm recording on how to use the script and on how to use the map you create with it in a UDK shader, you will have viewport preview at your disposal
Offline , triangle, 341 Posts, Join Date Aug 2010, Location Belgium Send a message via MSN to MaVCArt Send a message via Skype™ to MaVCArt  
   Reply With Quote

Computron's Avatar
Old (#59)
The problem is nothing actually shows up in the actual map. Is this compatable with max 2012 64?
Offline , dedicated polycounter, 1,451 Posts, Join Date May 2011, Location Minnesota, USA  
   Reply With Quote

Norman3D's Avatar
Old (#60)
Quote:
Originally Posted by Computron View Post
The problem is nothing actually shows up in the actual map. Is this compatable with max 2012 64?
I noticed this as well. I think that in order for the changes to be saved to the map (in this version) you have to disable the "SB" brush button and the "Painting" button.

But in the next version Mattias releases it will be saving the changes to the bitmap file in real-time.
Offline , spline, 153 Posts, Join Date Jan 2008,  
   Reply With Quote

MaVCArt's Avatar
Old (#61)
Quote:
Originally Posted by Computron View Post
The problem is nothing actually shows up in the actual map. Is this compatable with max 2012 64?
it should be, that is my version of max but as norman said, it could be that the script does not yet save the bitmap if you exit max without "properly" exiting the script
Offline , triangle, 341 Posts, Join Date Aug 2010, Location Belgium Send a message via MSN to MaVCArt Send a message via Skype™ to MaVCArt  
   Reply With Quote

MaVCArt's Avatar
Old (#62)
right, here's a new update for you guys!

a big one this time, unfortunately I haven't had the time to record a proper video of it being used, or one of how to use the map properly in a shader. i'm working on it though, but I want it to be good for you guys

the big features that are now working:

realtime viewport preview, enabling you to paint in real time, on your mesh, with a shader previewing the flow map applied in a shader. (both made possible by Norman "Norman3D" Schaar, thanks man!)

normal square brush

normal circular brush

eraser (this is gonna be handy)

fast performance

bitmap saving upon properly exiting the script (disabling the brush button)


incoming: soft circular brush, airbrush and noise brush, of which the soft circular brush is the most prominent.

also, in this version of the script, the UI got an overhaul, taking up less space, and removing obsolete UI elements that were confusing to begin with. (again, courtesy of Norman Schaar on what to remove, thanks again ;) )


that's about it, here's a screenshot of the script/plugin in action:



and here's, again, the download link for the plugin

http://www.scriptspot.com/3ds-max/sc...ow-map-painter


ps: unfortunately, apart from the weekends, I wouldn't exptect too many updates for the next two weeks: i'm hard-pressed to finish a freelance assignment and I gotta make that deadline
Offline , triangle, 341 Posts, Join Date Aug 2010, Location Belgium Send a message via MSN to MaVCArt Send a message via Skype™ to MaVCArt  
   Reply With Quote

Ace-Angel's Avatar
Old (#63)
Mother of all that is digital! Just gave it a quick whirl and it's soo much fun!
There's a very good chance that I experienced MORE problems, then all the internet put together in the area of 3D. Talk about being original for once...
Offline , veteran polycounter, 4,501 Posts, Join Date Apr 2011, Location Canada  
   Reply With Quote

havardsc's Avatar
Old (#64)
Looks good man.
Looking at the last picture, what color space are you painting in? Default color seems to be black and you use the blue channel?
Offline , null, 18 Posts, Join Date Oct 2010,  
   Reply With Quote

Computron's Avatar
Old (#65)
Still not working for me. Followed the instructions multiple time to the T. Only paints these small dots now:



Also, the realtime shader just shows a bright solid grey.
Offline , dedicated polycounter, 1,451 Posts, Join Date May 2011, Location Minnesota, USA  
   Reply With Quote

MaVCArt's Avatar
Old (#66)
Quote:
Originally Posted by havardsc View Post
Looks good man.
Looking at the last picture, what color space are you painting in? Default color seems to be black and you use the blue channel?
yes, this is something me and Norman have had heated discussions over: in order to only use the R and G channels, we have to use only half of the 255 values, and since those are integer values, 2*0.5 gets lost. not only is this bad for accuracy of the flow map, it is also a source of problems: a solid color of 128 for everything but the parts that flow actually results in the entire texture panning very slightly. I have looked into just putting solid white in the blue channel to be able to use that as a mask, and then perhaps using the alpha channel for generating a foam mask or something, but it's something that is currently under heavy discussion

also, @Computron: looks like you're using the soft brush, that's not working at the moment i'm afraid :s only the first two brushes with "NB" and "CB", as well as the eraser ("ER") are working

I should have disabled the non working buttons in the UI for now, but keep in mind that this is still a WIP and actually still an alpha ;)
Offline , triangle, 341 Posts, Join Date Aug 2010, Location Belgium Send a message via MSN to MaVCArt Send a message via Skype™ to MaVCArt  
   Reply With Quote

SirCalalot's Avatar
Old (#67)
Sweet Jesus I need to get home and try this new version.

Also, are there plans to have icons instead of letters on the brush buttons? I know that these are the least of your worries at the moment, but I thought I'd mention it for later down the line
Offline , polycounter, 859 Posts, Join Date Nov 2011, Location Birmingham, UK  
   Reply With Quote

MaVCArt's Avatar
Old (#68)
Quote:
Originally Posted by SirCalalot View Post
Sweet Jesus I need to get home and try this new version.

Also, are there plans to have icons instead of letters on the brush buttons? I know that these are the least of your worries at the moment, but I thought I'd mention it for later down the line
thanks, great to hear ^^
and yes, that's actually the first thing on my agenda once I get the soft brush working: getting the UI up and running properly, and more user-friendly. I have some images ready and waiting, they'll be included in the next update

also, I just modified the .rar file: the whole thing was confusing since there was a .ms file twice and a .fx file twice... now, there are only the necessary files,

so @Computron, it might be that you ran the old version of the script, in which case it's understandable and entirely my fault, I sincerely apologise please re-download and re-run, it should work fine now

edit: for those of you not using 3ds max 2012, I am going to compile a 2011 and 2010 compatible version this evening, if I can manage to make that work
the reason they're not compatible is because the header file libraries of the SDK have apparently been randomized or something between the 2011 and 2012 versions of max, which is why it's not a simple matter of re-compiling and passing another version of the software to the compiler. it's actually a matter of downloading the 2011 SDK, figuring out the header file library structure for it, creating a solution file with that SDK, including the header files I need, and then re-compiling it for both 64 and 32 bit. easier said than done, but at least I know which header files I need :p

Last edited by MaVCArt; 05-22-2012 at 02:01 AM..
Offline , triangle, 341 Posts, Join Date Aug 2010, Location Belgium Send a message via MSN to MaVCArt Send a message via Skype™ to MaVCArt  
   Reply With Quote

SirCalalot's Avatar
Old (#69)
God speed, MaVCArt.
Offline , polycounter, 859 Posts, Join Date Nov 2011, Location Birmingham, UK  
   Reply With Quote

MaVCArt's Avatar
Old (#70)
edit: i'm sorry for the people who don't use max 2012, but i'm gonna have to wait until this weekend to compile a version for max 2010 and 2011, i'm afraid I don't have time right now :s in the meantime, i'll try to fix the alpha channel still being lost and to keep working on the video, but i can't promise anything before the weekend
Offline , triangle, 341 Posts, Join Date Aug 2010, Location Belgium Send a message via MSN to MaVCArt Send a message via Skype™ to MaVCArt  
   Reply With Quote

cman2k's Avatar
Old (#71)
This is a tool with great potential!

The 3ds max shader you are using was flawed (No offense). It offset UVs positions rather than rotate their vectors, so it did not show flow properly. I have resolved this using Valve and Kyle Hayward's work as a model.

The way this plugin encodes it's information is also flawed, I think. I believe the green channel's information is flipped. I analyzed the data a lot and made my shader as correct as possible according to other examples and math I have seen. In order to get my shader to work properly with the data generated by this plugin, I had to manually invert the green channel's output.

I would be happy to release this shader I am showing here - given you look into the channel-flipped issue and we work out what's going on. I don't want to release it with the hack it currently has.

I look forward to seeing this further improved...great work so far!




P.S. - Bug visible in my gif preview: sometimes the bottom left of the texture gets random input...I think it may be related to brushstrokes near the edge of the object, that don't get their positions caught and default to the zero/zero position.
Portfolio of Carlos Montero
Project Lead: Black Mesa
Offline , triangle, 422 Posts, Join Date Nov 2005, Location Los Gatos, CA  
   Reply With Quote

Norman3D's Avatar
Old (#72)
There is nothing "incorrect" about the shader or in the shader in your link.

The flowmap in the link you posted contains +U +V and -U and -V deformations in the red and green channel.
The issue here is that the neutral/non deformation color has to be a perfect grey color, 50% white. Since we have a 0-255 range the correct neutral value would be 127.5. But we can't have floats in pixels .
This results in inaccurate distortion, specially if you start tweaking the strength of the distortion. The neutral color will be wither and will thus pan the texture in U and V, when it should remain still.

In order to avoid this the flowmap in this script is using 4 channels:
Red = +U
Green = +V
Blue = -U
Alpha = -V
The shader then adds the red channel to the (inverted) blue channel.
The green shader is "added" to the (inverted) alpha channel.
Finally this is added to a UV_Coordinate node.
If there are no deformations all 4 channels will be black, adding this to the UV_Coordinates, will result in no change whatsover, which is the intended result.
This method also has twice the range of information at our disposal since we are storing half of the distortion in two additional channels.

Additionally we could convert a 4 channel flowmap to a flowmap, like the one in the link you provided, with a simple photoshop action. All you would be doing is compressing the information stored in 4 channels in just 2. You'll have 50% less precision and then of course the issue with the neutral color not being mathematically neutral, and shifting stuff around. I hope that clears it up!

EDIT: regarding the "vectors rotating". This is entirely up to you. The example shader is doing an offset to the UV coordinates. You have two values that control the offset speed in X and Y.

In UDK you could tile the coordinates or rotate, or flip them, whatever you want. It's independent from the deformation.

Last edited by Norman3D; 05-23-2012 at 04:53 AM..
Offline , spline, 153 Posts, Join Date Jan 2008,  
   Reply With Quote

cman2k's Avatar
Old (#73)
Hmm. Thanks for the additional information, it's interesting, for sure. I presumed you were working with a model similar to everyone else, and I did indeed notice the problem you mentioned, so it's pretty cool that this plugin finds a way around the accuracy issues.

A photoshop filter does seem a little cumbersome to me...maybe eventually this plugin can support both a 2-channel method and a 4-channel method? The 2-channel method seems pretty established, even if the 4-channel method is more accurate and clean.

Also if the shader included is correct, I'm still confused as to why it doesn't have the same kind of directional changes as mine. It doesn't make the texture pan different directions, the way my preview does, as far as I can tell. It just offsets their pan, which doesn't really help you preview which directions you are painting...?
Portfolio of Carlos Montero
Project Lead: Black Mesa
Offline , triangle, 422 Posts, Join Date Nov 2005, Location Los Gatos, CA  
   Reply With Quote

Norman3D's Avatar
Old (#74)
Quote:
Originally Posted by cman2k View Post
A photoshop filter does seem a little cumbersome to me...maybe eventually this plugin can support both a 2-channel method and a 4-channel method? The 2-channel method seems pretty established, even if the 4-channel method is more accurate and clean.
I guess a button could be added to the script that converts the existing 4channel flowmap to a "traditional" 2 channel one.

Quote:
Originally Posted by cman2k View Post
Also if the shader included is correct, I'm still confused as to why it doesn't have the same kind of directional changes as mine. It doesn't make the texture pan different directions, the way my preview does, as far as I can tell. It just offsets their pan, which doesn't really help you preview which directions you are painting...?
Well it's not a matter of correct or incorrect. The provided shader as it's setup, pans in the U axis I believe. You can tweak it so that it pans in U and V. This makes sense to me for stuff like the water in L4D2, where it need to go into a certain direction to guide the player.

If you want the texture to rotate you'll need a different shader. But the flowmap is still 100% valid.

If you want to see what direction you are painting, maybe use a different checker texture? I think it's also a bit hard to tell at the moment because the circle brush is very harsh and has no fall-off. Once that is implemented I'll make much more sense imo. For now try to blur the final flowmap in photoshop and check the results with the shader.

The brushes should be quite intuitive, they work similar to the smudge brush in photoshop.
Offline , spline, 153 Posts, Join Date Jan 2008,  
   Reply With Quote

cman2k's Avatar
Old (#75)
Quote:
Originally Posted by Norman3D View Post
Red = +U
Green = +V
Blue = -U
Alpha = -V
So I was puzzling over this part, because I noticed that my painted flow maps had empty (white) alpha channels, every time.

Then I did a test for Y, and I noticed that it doesn't matter if you paint positive or negative, up or down...it always draws the same type of data. Definitely think there is something wrong going on here.



It brings up a good point though...if this is really going to store data in the alpha channel, and we want feedback through the preview image - how do you give feedback for the alpha channel's data?

It's funny - I now realize that my previous image was working only by chance. I painted my Y info fast on one side and slow on the other, and that just happened to work with my shader (which was presuming slow was up, and fast was down).

Last edited by cman2k; 05-23-2012 at 09:56 PM..
Portfolio of Carlos Montero
Project Lead: Black Mesa
Offline , triangle, 422 Posts, Join Date Nov 2005, Location Los Gatos, CA  
   Reply With Quote

Reply

Thread Tools
Display Modes

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

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Copyright 1998-2012 A. Risch