Jump to content

Post-processing effects test (SSAO/HDR/Bloom)


Recommended Posts

Myconid's random experiment #2842: Animated water material that can be attached to models.

http://imgur.com/QfhzH

No reflections or refractions. Not sure how efficient those would be to render. Maybe they can be faked with static simple/cube textures instead...

:dance3: What are the concerns about efficiency of reflection/refraction? Is it different from other water rendering?

Link to comment
Share on other sites

Does this mean we can create mountain lakes and aqueducts with animated water? :thumbup:

Does it work by making a prop to use a certain texture?

Aqueducts yes, lakes no(t yet). Yup, basically it attaches a new material type to a transparent plane that is then attached as a prop to a model. The material uses a normalmap/specular shader + some new "renderquery" stuff in the engine (a system I've been working on for materials to query the renderer to give them specific info, such as the game-time, the water texture etc).

For lakes I want to modify the "global" water instead, which completely separate from this. Specifically, I want to make it possible for the global water plane to be deformed just like the terrain plane.

Link to comment
Share on other sites

:dance3: What are the concerns about efficiency of reflection/refraction? Is it different from other water rendering?

Well, for reflections at least, everything needs to be rendered upside down. The more reflections you have, the more times you need to re-render everything for each frame. For refractions you need to "cut out" the bottom of the water and render it separately to a texture.

Not sure if there's a clever way to do all of these at the same time (nothing comes to mind), but there must be a way to do it, I just haven't thought it yet.

The alternative I was thinking is to simply have some prerendered textures that we use for relfections/refractions. For example, we could just reflect the sky texture and refract a static "reservoir-bottom" texture. As long as they roughly look like they are moving correctly relative to the camera, it may hide the fact they aren't real reflections.

Edited by myconid
Link to comment
Share on other sites

Yup, that looks more correct! http://imgur.com/a/CkHWf

In regards to parallax: when you are creating heightmaps remember that the parallax effect actually goes inwards (i.e. the real surface of the polygon is at height=white). If your entire polygon is much lower than that, it gets pushed inwards and the effect doesn't know what to draw to fill in the gaps at the edges. That's why you got tiling gaps on the roof of the roman civil centre. The solution? Make the brick heightmap brighter, until the tops of the stones=white.

Lets try this one. Sorry, no specular yet - I got distracted by the water thread.

post-3-0-96138300-1342497673_thumb.png

Link to comment
Share on other sites

Whoops looks like I forgot to add the civic centre files to that branch, sorry! Mars_temple2 should work, though!

I pulled again effectdistance2 branch but I get nothing new.

Uh, indeed you didn't say that :stinker:

Is there a map with Mars_temple2 already built, I don't have the time now to play to get it.

Edited by fabio
Link to comment
Share on other sites

There seems to be a file missing in your 'merged' branch. I can't seem to compile it at the moment.

Not very specific, though I think it should be there now.

Lets try this one. Sorry, no specular yet - I got distracted by the water thread.

Closer now! http://imgur.com/sCObb

Is there a map with Mars_temple2 already built, I don't have the time now to play to get it.

Added a test map for you.

Edited by myconid
Link to comment
Share on other sites

Thanks, now I get this, with a load of:


r300: ERROR: FS input generic 20 unassigned, not enough hardware slots (it's not a bug, do not report it).
r300: ERROR: FS input generic 20 unassigned, not enough hardware slots (it's not a bug, do not report it).

screenshot0007x.png

Link to comment
Share on other sites

You can probably merge some things together. In the ARB shader, to stay under the 8 texcoords used, I had to put the v_tex and the v_los vec2 together in a vec_4, for example.

Yup, already did that and also reworked the math a bit. Hopefully it won't mind the crapload of uniforms that are getting merged from the modelmapping branch, though. :whistling:

fabio, please try it now! (and fingers crossed)

Link to comment
Share on other sites

Merged branch compiled. Appears things working properly (though the bumpy roof effect is less obvious now(?)).

I get this when enabling water reflections from Menu > Settings.


ERROR: Failed to compile shader 'shaders/glsl/water_high.fs':
ERROR: 0:100: No operator '*' exists taking 'int' and 'float' (and no implicit type conversion allowed in GLSL 1.10)
ERROR: 0:101: Use of undeclared identifier 'shadow'
ERROR: 0:106: Use of undeclared identifier 'fresShadow'
ERROR: 0:108: Use of undeclared identifier 'colour'

Link to comment
Share on other sites

Merged branch compiled. Appears things working properly (though the bumpy roof effect is less obvious now(?)).

The effect hasn't changed - it's because I'm using Wijitmaker's hand-crafted heightmap.

I get this when enabling water reflections from Menu > Settings.

Thanks for reporting. :) That's probably due to my laziness (i.e. I type 1 instead of 1.0), combined with the fact that ATI's GLSL compiler is very permissive so I don't get those errors. Imho, since GLSL describes itself as a C-like language (instead of Java or such), the compilers should be very permissive.

But I digress. I've changed the water shader GLSL version from 1.10 to 1.20 to match all the other shaders, and it should work now.

Link to comment
Share on other sites

I'm using a cubemap to simulate sky reflections on arbitrary water planes. Works pretty well, I think.

http://imgur.com/a/vgOsb

Nice. I assume the only limitation is that other objects won't be reflected?

Well, for reflections at least, everything needs to be rendered upside down. The more reflections you have, the more times you need to re-render everything for each frame. For refractions you need to "cut out" the bottom of the water and render it separately to a texture.

For reflections, would it not be sufficient to render once per angle of the reflecting plane?

Link to comment
Share on other sites

For reflections, would it not be sufficient to render once per angle of the reflecting plane?

You need to reflect the water height too. So for each height that has a water plane, you'd need to re-render the whole screen. Even with proper optimizations, given that the terrain is rarely perfectly flat, this would probably be a fairly big performance hit.

Link to comment
Share on other sites

Nice. I assume the only limitation is that other objects won't be reflected?

For reflections, would it not be sufficient to render once per angle of the reflecting plane?

That's the limitation, and what wraitii said is correct.

Not reflecting objects would look weird... Is this possible for the modder to change it he wish, or it's hardcoded? I mean, all water that is not in the ocean. Water in actors... I think you know what I mean. :P

The water on the objects is completely moddable and separate from the ocean water. You can edit the parameters by creating as many materials as you need.

The missing reflections aren't too noticeable, tbh, but you can tell they're missing if you're looking for them. The reflections are basically the only hardcoded thing I use, which are generated using a cubemap of the skybox textures. We do have a couple of options to improve this...

A worthwhile side-project would be to add support for loading cubemaps through the usual texture manager (so basically custom cubemaps loaded from the actor xml). This would allow us to at least have self-reflections in the water, but not reflections of other objects or terrain. It would also let us fake materials that look like this.

A more challenging, but higher quality, solution would be to actually render our own cubemaps when there are large changes in the game-world (e.g. only after a new building is completed). Each reflective object instance would need its own low-resolution cubemap (i.e. somewhat large memory usage), and would need 6 renderings of the game-world for each update. This would give us accurate results, and may not be too performance/memory intensive since there probably won't be too many of these reflections.

Link to comment
Share on other sites

Thanks.

You need to reflect the water height too. So for each height that has a water plane, you'd need to re-render the whole screen. Even with proper optimizations, given that the terrain is rarely perfectly flat, this would probably be a fairly big performance hit.

Is this the case even after culling? I mean, very little actual geometry would seem to have to be drawn on small reflective surfaces like those in myconid's screenshot.

Link to comment
Share on other sites

Is this the case even after culling? I mean, very little actual geometry would seem to have to be drawn on small reflective surfaces like those in myconid's screenshot.

Yeah, I've been thinking about that. I'm concerned that the cost of culling may exceed that actual cost of rendering...

Okay, here's what we can do for efficient culling: we divide each game map into regions and store the static models in a 2d array of hashmaps, where each array element corresponds to a separate region. Every time the reflections need to change, we use the 9 regions around the model to re-render its cubemap. Sounds workable to me..!

On hardware that supports MRT, we can actually render all sides in a single pass!

The only remaining question is the size of the cubemaps in memory. For reflections, 128x128 is probably enough and I think comes out at 400k per model. Not bad.

Edited by myconid
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...