YOUR ACCOUNT

Login or Register to post new topics or replies
Tim2501
Posts: 26
Filters: 63
Hi, everyone!

I have a little puzzle for you I never could quite solve:
I'm trying to create underwater-caustics for a game I'm working on. I baked a cycle of water-normalmaps I want to create the caustics from, but nothing I try will produce nice looking caustics. Any ideas if/ how it can be done in FF?

Here's some informative article about it:
GPU-Gems: Water caustics

I've also attached one of my normalmaps you can play around with...

  Details E-Mail
Skybase
2D/3D Generalist

Posts: 4025
Filters: 76
The math's kinda crazy haha. I don't know if that can be thrown into FF. But I'm pretty certain it can be faked (accuracy aside). Just in my head I'd first convert the normal map to a bump map and the rest would be tinkering with some values and fudging looks and feelings. I know it's not the best of answers but that's just what I'd do.

Pretty crazy though haha.
  Details E-Mail
Rachel Duim
So Called Tortured Artist

Posts: 2498
Filters: 188
Here's something I tried with a snippet of code I threw together. If it's useful, let me know and I will post it here.
Rickster

Math meets art meets psychedelia.
  Details E-Mail
Rachel Duim
So Called Tortured Artist

Posts: 2498
Filters: 188
Here's another one, a little more subtle.

Math meets art meets psychedelia.
  Details E-Mail
Skybase
2D/3D Generalist

Posts: 4025
Filters: 76
Rick, I think Tim means he wants to use the already-exported normal map to generate caustics applicable to other images/textures.
  Details E-Mail
Rachel Duim
So Called Tortured Artist

Posts: 2498
Filters: 188
True, the image is a height map. My thought was this, in FF it's probably easier to use the refraction tool and the edge detection tool on an existing image (as opposed to trying to create a normal based on the crazy math smile;) ). My reasoning, the refraction in water or glass varies based on the peaks (eges) and valleys in the image. However, this method only really works well on gradients...
Math meets art meets psychedelia.
  Details E-Mail
Rachel Duim
So Called Tortured Artist

Posts: 2498
Filters: 188
Might be helpful: Fast Real-time Caustics from Height Fields.
Math meets art meets psychedelia.
  Details E-Mail
ThreeDee
Lost in Space

Posts: 1672
Filters: 112
Simplified (not real) caustics from normal map with Loop:

  Details E-Mail
ThreeDee
Lost in Space

Posts: 1672
Filters: 112
Even More simplified without a Loop:

  Details E-Mail
ThreeDee
Lost in Space

Posts: 1672
Filters: 112
Alternate method.

  Details E-Mail
Rachel Duim
So Called Tortured Artist

Posts: 2498
Filters: 188
Those look really good! smile:D How did you do these?
Math meets art meets psychedelia.
  Details E-Mail
ThreeDee
Lost in Space

Posts: 1672
Filters: 112
Here's the simplest method that the second image was done with. Needs your normal map as the source image.

(I actually did it first much more complicated before I realized the Lookup component does it in one go...)

Simple Caustics from Normal Map V0.5.ffxml
  Details E-Mail
Rachel Duim
So Called Tortured Artist

Posts: 2498
Filters: 188
Thanks. I'm going to take a look at this. I've already done some experimenting with the Lookup component. Powerful, takes a bit of thought to wrap your mind around the function. I've already used it for tiling, boring compared to this smile;)
Math meets art meets psychedelia.
  Details E-Mail
ThreeDee
Lost in Space

Posts: 1672
Filters: 112
It is essentially a single-ray caustic: you shoot one ray directly up and use the normal map to check where in the sky the ray will hit. The circular gradient acts as the sky with the sun directly overhead. You can move the sun around in the sky and get it looking different.

Real caustics require multiple rays, but like your references show, the math gets more involved. It is probably not all that difficult to script, but doing the refraction math without scripting can be tricky, as the outgoing rays are not perpendicular to the surface.
  Details E-Mail
Rachel Duim
So Called Tortured Artist

Posts: 2498
Filters: 188
Good stuff. I am going back to school, so to speak. Gotta get my trigonometry skills back up to speed. Haven't used trig or calculus much since college. Caustics are a future challenge, again, thanks for the snippet.
Math meets art meets psychedelia.
  Details E-Mail
Tim2501
Posts: 26
Filters: 63
First of all, thank you for all your suggestions smile:D
I have tried some stuff with the lookup-component myself and came up with a nice solution, which, though not physically correct, looks quite nice.

I have attached the snippet, which also contains some of my earlier attempts.



CausticsFromNormals.ffxml
  Details E-Mail
SpaceRay
SpaceRay

Posts: 12302
Filters: 35
This looks very good and interesting, although I do not have time to test it smile:(
  Details E-Mail

Join Our Community!

Filter Forge has a thriving, vibrant, knowledgeable user community. Feel free to join us and have fun!

33,719 Registered Users
+8 new in 7 days!

153,546 Posts
+6 new last day!

15,348 Topics
+71 new in year!

Create an Account

Online Users Last minute:

33 unregistered users.