Writing a texture plugin to produce water effects

I can’t figure out how to do the above.
Manual still in the post!
:expressionless:

Yes, that is what I meant. Anyway, as I said, you can just do the same as in the python code example, adapted to your code, you could do this:


if (ix < 0) ix = 0; else if (ix > (WIDTH-1)) ix = WIDTH-1;
if (iy < 0) iy = 0; else if (iy > (WIDTH-1)) iy = WIDTH-1;

but this wouldn’t really look good, as the texture would only be visible in a limited area in space and the borders would be stretched beyond those limits (like using ‘Extend’ clipping in Blender for images).

better would be the wrap around solution:


ix %= WIDTH;
if (ix<0) ix += WIDTH;
iy %= WIDTH;
if (iy<0) iy += WIDTH;

which will make the texture repeat throughout texturespace.

I will look at your Python code, but I have it in my head that it’s operating on the nodes of a mesh - this is a nice and predictable number of items, counted from 0 up to X.

There is no real difference, just think of the mesh as the texture grid, the displacements are simple those values you return as intensity.
With your texture plugin you can actually do the same thing using displacement mapping.

With the textures, the picture is very messy and it’s too fuzzy for me to make sense of. I don’t want to give up for lack of information!

You can always mail me if you need more help, or I’ll try to answer any question here when I can. But I’m sure there are others that can help too.

Did you compile and run the code at all?

Yes I did (on linux), and it compiles, but it doesn’t do much yet.

I can’t figure out how to do the above.
Manual still in the post!

Maybe this helps a bit:
http://download.blender.org/documentation/NaN_docs/Manual2.0/ScriptButtons.html
It is from an older blender version, but still useful. Just find that button you see at the top, then you will see in a panel something like:
Scene scriptlink [0 Scr: 0] [New]
Click new, and type the name of the script in the button. Then use alt-a key in 3d view to start the animation.
Or I could also send you a blendfile if you want, so you only have to use alt-a to see it.

edit: a better more recent description of the scriptlink panel from the downloadable manual:
http://www.blender.org/modules/documentation/htmlII/x4544.html

Wow, if this isn’t the most confusing thread in the world to follow, I don’t know what is. :slight_smile: I’m interested to see this thing finished, but hearing how it’s done is mindboggling.

eeshlo - thanks for the offer to help. I would also like other, informed input, but you seem to be it right now!

I will hack-on for a while, and failing any result will try to be very clear about where I am stuck and then will email you.

I have limited online time, so my postings are and will be sporadic.

Until later
Cheers!

jts01 : You think your mind is boggled?
I’m the king of “Hello World!” programming but as far as complex stuff like textures (well, complex for me) damn my brain is all warm and I have ice-cubes on the top!

I am on version 6 of my plugin. It is looking quite good, but needs a little more work.
This is a new kind of texture (I think) in that it uses an off-screen image area to draw the effect into and then that is transferred onto the final texture. This causes some hassles with animation and resetting the effect.

I will post the source here next week when I am happy with it.
Thanks go to eeshlo for his help - I solved that weird u,v problem: it was a clash of plugin versions due to a badly time ctrl-U that saved an old version of the plugin to the default file. Now the array to uv mapping is working well.

I have no web-space and don’t know how to post images here, so I can’t show you what it’s looking like.

Ok cheers.

I’ll galdly host what ever you need, just email to [email protected] <-- 100 meg email max.

Hope to see loota good come from this script ^_-

Hey Sutabi, thanks. I will send you some stuff as soon as I can and you can decide if it’s worth the bother!
:slight_smile:

hey biggles i’ll host it too, just give the word.

MacBlender

Great, thanks for the offers - email is on its way to you with water1.0 all zipped-up.
It needs work; hey, it needs a miracle! But it’s working and I am way pleased with that.

Let me know how it grafts for you, I suspect there are going to be seg-faults and tears before render-time.

ciao.
8)

Bugs:

  1. You can’t seem to have 2 different textures of the same plugin. The pattern in one jumps to the pattern in the other.
    What to do?

  2. Strange issues with applying the tex to things other than a plane.

  3. The obvious low-res of the texture - this is due to the uv to index issue in the code.

:wink:

http://mhserver5.biz/~sutaitk1/biggles/water/

If you want, and have a ftp program i can set up an account for you.

I’ll have a windows DLL done in a sec, i’ve had to do some code modification to get VC++ 6.0 to compile it without errors.

MacBlender

Thanks guys!
Dare I say it? Please hold-off for a moment.

I have sent the source to eeshlo and he has already made some very cool changes, like “bilinear interpolation” - I kid you not! It makes the texture much smoother.

I think I shall work with eeshlo until the plugin has the major bugs plugged and I will email you two the versions as we go along: for your amusement.
When the thing is solid, then we can muck about with FTP and a tutorial.

Cool?
:smiley:

PS - What did you think of the version I sent y’all?
:o

welll… i couldn’t get it to work. it compiled but gave an error when i tried to load it in blender.

MacBlender

Sorry MacBlender - I can’t help with windows :frowning:
Have you tried the gnu compiler gcc = i understand you can get a version to work on windows?
Alt you may have to wait a while - ask around maybe someone will help us convert it.

I’m goign to look into windows plugin compiling and check it out i might have to rewrite your code entirely.

my expertice is getting python modules to work.

MacBlender

macBlender,
Good luck with that - don’t kill yourself as the code will be changing for a while until it’s working well.
Anything you learn, post here for ref.
Cheers.

Hello, I do a compilation for Windows with LCC, I send it to Sutabi.
To compile, I make:
I put all the Blender plugins include and the source of the wave plugins in the same directory so I don’t have to specify the include directory for lcc.

To compile I remove the last line (hnoise) in tex.def without removing this line, the plugin compile but doesn’t work in Blender.


lcc.exe wave1.0.c //if the include is not in the same directory of wave1.0.c you should add -I the directory of the include
lcclnk -DLL -NOUNDERSCORES wave1.0.c tex.def

I do not know what to do for Windows Dll’s.

That it does not work on Windows is very dissapointing.

There is an issue with a function called hnoise that Windows cannot access (it lives inside the Blender binary/exe). I am waiting for some custom noise code from eeshlo, and I hope to have someone get that working on Windows ok.

Until then …
:expressionless:

Windows water1.0 at http://www.platomic-junior.com/~ffzone/blender/Content/water1.0.dll

Windows water0.2 (more effects) at http://www.platomic-junior.com/~ffzone/blender/Content/water0.2.dll