Problem is, UDK doesn't allow for proper distortion with refraction unless you're planning to make the effect a Post-Process that's constantly infront of the player and follows the camera.
What exactly are you trying to do? Is the effect going to be on a mesh? Is it camera oriented? Can the player move around (which will break the effect), etc...
It's a player deployed bomb that creates a black hole.
I had planned on creating a distort material and applying it to a player facing particle.
The view will be top down, but rotatable.
Can you go more into this World Transformed refraction? I tried to google it, but this thread popped up as number 1, and the other results showed nothing.
Cheapest way would be to setup a ScreenTexture, and feed one of them (standard), and the another one flipped (180*) into a Lerp node, with a phong like texture in the Alpha for the effect, should be cheap and convincing enough.
Then, multiply a black phong like texture which is smaller, in the place where the you want the black hole to be. Should be good enough and cheap.
===
A more complicated way and more 'law' accurate:
You need to first setup your Refraction, the most standard and common one is Snell's, which can be found here:
Once that is done, IIRC, you need to then feed the setup into a Transform node, and that will essentially 'flip' the cubemap/screen 180* automatically.
I suggest lerping then between a cube/screen texture and the flip with an Alpha, the alpha should be an inverted fresnel with an alpha to guide it, which will distort stuff at the center and the outer parts will be normal parts.
You then multiply a black texture over the 'black' hole point, and that should give your a correct looking effect.
===
Both ways are valid, it's just one of them is more 'realistic' and physical law correct while the other is just the 'effect', should be good enough for games
haba you were a great help. I'm trying to convert it from a uv distort to a distortion effect and it's... not going as well as i'd hoped.
It's a cool effect. But for some reason it seems to be shifted from the top right to the bottom left. Stretching it at the top right and squashing at the bottom left.
Then theres the black hole center. Since distortion is additive, I can't really multiply black. Maybe negative?
-edit-
oh and theres also the fact if it's near the top of the screen it kind of stops working properly.
I played with it a little since then trying to get it to expand in the center instead of how it does in Haba's example.
It now does. I guess what i've created is basically a giant sphere on the uv map.
Using a negative square root it curves a grid into this. It goes on forever no matter how much you zoon in, that's neat I suppose. But I mainly posted this so you can see the material tree.
I suppose you can think of there being 2 rings around a black hole, the outer ring distorts objects around it, and an inner ring with shows the object distorted directly on the opposite side like a mirror.
I guess my question is, while I'm doing this all for testing on a uv of a texture, as doing it all on the distortion node is very hard.
Can I just unplug it from texture uv and into distortion?
.. But for some reason it seems to be shifted from the top right to the bottom left. Stretching it at the top right and squashing at the bottom left..
this is done by design in segment "2". I thought it will be more mathematiclly correct (maybe i was wrong). Shifting from TR to BL is done by sub(0.5) mult(-1) add(0.5). Stretching is done by mult with sphere mask.
Unfortunately i have no idea how distortion material on particles works.
One thing that comes to my mind how to solve this is creating scene capture and operating on captured frame the way i did and then displaying this in front of player. I don't know if that makes any sens.
UDK doesn't take into account 3 vectors for most textures, EXCEPT the cubemap, which in turn, doesn't take into account RT environments in most cases, and those that do, don't show their posterior.
So that's why you're getting the Rubik cube effect inside a black hole, as I previously stated.
Honestly, as I said, just used two ScreenTexture's, flip one 180 and the other one, keep it standard, then use an Alpha in a lerp (phong like textures) and have that manage your distortion.
Then, mutiply a black spot in the final result (for the Diffuse) with the Alpha.
It's the easiest solution without getting overly complicated.
You either full physical with Snell's refraction and account for a bazillion variables and manage a whole slew of problems, or you just fake it. You can't get the middle ground since UDK doesn't allow it.
I replaced Haba's "1" to make it expand around the sphere and this gives the perfect result.
I'm not sure how to do yours Ace, but here's the result.
I just replaced the uv alteration of the grass with the scenetexture. The problem being it looks like a mirror ball and doesn't actually distort. Theres also the problem with those black.. taco shaped things. I have no idea what's causing those.
I have no idea if this is what you intended it to look like or I didn't do it right.
It's nearly finished.
It distorts things behind it around it. And it reflects objects (although not accurately, but I can't see it mattering much).
Things that need to be solved now, it still looks like glass, and its glowing. Also the black tacos, I guess the uv manipulation is behind it or something, I'm not entirely sure.
Neat effect, but I wonder how well geometry would play with the inner reflection.
Speaking of which, I recreated your material and tested it out. The farther you zoom out from it, it actually flips the distortion reflecting the sky on the bottom, etc.
Neat effect, but I wonder how well geometry would play with the inner reflection.
Speaking of which, I recreated your material and tested it out. The farther you zoom out from it, it actually flips the distortion reflecting the sky on the bottom, etc.
Would you know why that is?
My guess is that it's because how Epic implemented distortion in the material.
Replies
Problem is, UDK doesn't allow for proper distortion with refraction unless you're planning to make the effect a Post-Process that's constantly infront of the player and follows the camera.
What exactly are you trying to do? Is the effect going to be on a mesh? Is it camera oriented? Can the player move around (which will break the effect), etc...
I had planned on creating a distort material and applying it to a player facing particle.
The view will be top down, but rotatable.
Can you go more into this World Transformed refraction? I tried to google it, but this thread popped up as number 1, and the other results showed nothing.
Then, multiply a black phong like texture which is smaller, in the place where the you want the black hole to be. Should be good enough and cheap.
===
A more complicated way and more 'law' accurate:
You need to first setup your Refraction, the most standard and common one is Snell's, which can be found here:
http://thangnguyendemo.blogspot.com/2009/04/new-beginning.html
Once that is done, IIRC, you need to then feed the setup into a Transform node, and that will essentially 'flip' the cubemap/screen 180* automatically.
I suggest lerping then between a cube/screen texture and the flip with an Alpha, the alpha should be an inverted fresnel with an alpha to guide it, which will distort stuff at the center and the outer parts will be normal parts.
You then multiply a black texture over the 'black' hole point, and that should give your a correct looking effect.
===
Both ways are valid, it's just one of them is more 'realistic' and physical law correct while the other is just the 'effect', should be good enough for games
I'd just do this. The complicated solutions aren't worth the hassle. And nobody will know any different.
i'd upload gif but i can't get to work
It's a cool effect. But for some reason it seems to be shifted from the top right to the bottom left. Stretching it at the top right and squashing at the bottom left.
Then theres the black hole center. Since distortion is additive, I can't really multiply black. Maybe negative?
-edit-
oh and theres also the fact if it's near the top of the screen it kind of stops working properly.
It now does. I guess what i've created is basically a giant sphere on the uv map.
Using a negative square root it curves a grid into this. It goes on forever no matter how much you zoon in, that's neat I suppose. But I mainly posted this so you can see the material tree.
Additional info I may be over looking.
I suppose you can think of there being 2 rings around a black hole, the outer ring distorts objects around it, and an inner ring with shows the object distorted directly on the opposite side like a mirror.
I guess my question is, while I'm doing this all for testing on a uv of a texture, as doing it all on the distortion node is very hard.
Can I just unplug it from texture uv and into distortion?
this is done by design in segment "2". I thought it will be more mathematiclly correct (maybe i was wrong). Shifting from TR to BL is done by sub(0.5) mult(-1) add(0.5). Stretching is done by mult with sphere mask.
Unfortunately i have no idea how distortion material on particles works.
One thing that comes to my mind how to solve this is creating scene capture and operating on captured frame the way i did and then displaying this in front of player. I don't know if that makes any sens.
So that's why you're getting the Rubik cube effect inside a black hole, as I previously stated.
Honestly, as I said, just used two ScreenTexture's, flip one 180 and the other one, keep it standard, then use an Alpha in a lerp (phong like textures) and have that manage your distortion.
Then, mutiply a black spot in the final result (for the Diffuse) with the Alpha.
It's the easiest solution without getting overly complicated.
You either full physical with Snell's refraction and account for a bazillion variables and manage a whole slew of problems, or you just fake it. You can't get the middle ground since UDK doesn't allow it.
I'm not sure how to do yours Ace, but here's the result.
I just replaced the uv alteration of the grass with the scenetexture. The problem being it looks like a mirror ball and doesn't actually distort. Theres also the problem with those black.. taco shaped things. I have no idea what's causing those.
I have no idea if this is what you intended it to look like or I didn't do it right.
It's nearly finished.
It distorts things behind it around it. And it reflects objects (although not accurately, but I can't see it mattering much).
Things that need to be solved now, it still looks like glass, and its glowing. Also the black tacos, I guess the uv manipulation is behind it or something, I'm not entirely sure.
Speaking of which, I recreated your material and tested it out. The farther you zoom out from it, it actually flips the distortion reflecting the sky on the bottom, etc.
Would you know why that is?
My guess is that it's because how Epic implemented distortion in the material.