Akira-Hayasaka / ofxInkSim

openFrameworks ink/fluid deposition simulator addon.
149 stars 27 forks source link

About changing color of the WaterFlow Texture #2

Open arnoldyuhin opened 8 years ago

arnoldyuhin commented 8 years ago

Hi, I like this add-on a lot and trying to make something about it, but I am suffering in making some changes. When in the WaterFlow draw mode, I have no idea how to change the color. I'm using a particle system and following "ofxInkSimFillBufferExample" by storing the particles in a ofFbo and draw it within "inkSim.begin()" and "inkSin.end()". Should I change the shader code in "GetVelDenShader.h"? (I'm not that familiar with shader code :\ ) Is there any easier way to change the color just like other draw mode (hue color)?

Thanks in advance.

Akira-Hayasaka commented 8 years ago

Hi, to change ink color, I recommend to use getInkColor() function. https://github.com/Akira-Hayasaka/ofxInkSim/blob/master/ofxInkSimBrushExample/src/ofApp.cpp#L29

I made the INKSURF/INKFLOW/WATERFLOW mode for debugging purpose, and INKFIX is for true rendering. INKSURF/INKFLOW/WATERFLOW could be interesting effect, though..

arnoldyuhin commented 8 years ago

Oh, I didn't know that was just purpose for debugging since those mode are quite cool too lol. Would that be possible to change the INKFIX behaviour to make it looks like WATERFLOW mode? Actually I want the ink just dissolve out and disappear, which is most likely the WATERFLOW mode does. Should I work on the Shader code or the update() in ofxInkSim? Thanks!

Akira-Hayasaka commented 8 years ago

Yea, for me they were just for debug to visually check the shader result :) I added evapolation param to ofxInkSim::update() https://github.com/Akira-Hayasaka/ofxInkSim/blob/master/src/ofxInkSim.cpp#L61 With bEvaporToDisapper = true, the ink & water will be transparent(disappear) when it get dried completely. And the shader that responsible for this evaporation is here https://github.com/Akira-Hayasaka/ofxInkSim/blob/master/src/shader/InkXToShader.h

arnoldyuhin commented 8 years ago

Cool! The evapor one is very useful for me! Also I have changed some value in the shader and got what I want. Thank you so much!

arnoldyuhin commented 8 years ago

It's me again. I have make the ink style similar to what I want. But if the ink strokes overlap each others, the color become dark or even black. Would it be possible to have each brush on a new layer so the overlay part will not be darken?

Akira-Hayasaka commented 8 years ago

Currently it's not supported by this addon so we need to do it manually. (it might be useful to have some flag in shader that stop blending the ink color..)

So my idea is to draw ink tex into separate fbo then blend them manually using ofxPSBlend like I mentioned here https://forum.openframeworks.cc/t/ofxinksim-ink-deposition-simulator/19611/5?u=akira_at_asia

arnoldyuhin commented 8 years ago

I'm trying to make each InkSim into one fbo and use PSBlend to draw it together. However, when I declare the ofxInkSim in the the script other than ofApp.h, there will be an (lldb)error, which direct me to the size_type of the basic_string.h. I have no idea how can I make it work, do you have any experience about that?

arnoldyuhin commented 8 years ago

Or will there be any adjustment can I make so that the overlay part will become white instead of black? I'm just get annoyed by the black/dark color it made :(

arnoldyuhin commented 8 years ago

Opps, my bad, I was putting the declaration in the cpp file in stead of the header so there are lldb error. Now I am just suffering with the dark area when several stroke cross over. May I know where I can adjust this?