zoot Posted July 12, 2012 Report Share Posted July 12, 2012 The LOD thing we were talking about yesterday. Effects that recede into the background should be able to replace themselves with less resource-intensive alternatives.Are you aware of the <depth func="..."/> tag that can be specified per <pass>? It maps to glDepthFunc. Doesn't that effectively allow one to specify the distances at which a given shader should apply?I think that would require us to recompile each shader for every frame. Not really efficient.Maybe "defines" would be used, then? But then the configuration system should be able to get a list of possible defines from somewhere... Quote Link to comment Share on other sites More sharing options...
myconid Posted July 12, 2012 Author Report Share Posted July 12, 2012 Are you aware of the <depth func="..."/> tag that can be specified per <pass>? It maps to glDepthFunc. Doesn't that effectively allow one to specify the distances at which a given shader should apply?That's the comparison function for the depth buffer, so geometry that is behind other geometry doesn't get drawn. Completely different thing.Maybe "defines" would be used, then? But then the configuration system should be able to get a list of possible defines from somewhere...Define is for compiling, so same problem. We need something that does the comparison dynamically in the engine. It should be easy to do, though I'm afraid it'll have to wait till the weekend (as usual). Quote Link to comment Share on other sites More sharing options...
wraitii Posted July 12, 2012 Report Share Posted July 12, 2012 Add to this the possibility of hardware detection and automatic enabling/disabling of some effects. I don't like the possibility of not allowing a user to even access an effect because it would be too slow, though.I quite agree, though a warning is always nice (we could deactivate specific stuff it they would cause a bug, however). Quote Link to comment Share on other sites More sharing options...
historic_bruno Posted July 12, 2012 Report Share Posted July 12, 2012 For the final game release, we probably want a build script, that is perhaps separate from the main build scripts, that detects what meshes have been added/changed and calls Blender to bake their AO automatically.It would be handy to have a Blender script for automating the multiple UV set creation and AO baking. My thinking is even if AO support is added to the engine today, requiring artists to import every DAE, add a second UV set, export a new DAE and bake the AO texture, allowing for human error at every step, will be so time-consuming and boring that it will be put off due to higher priorities and interests.Several minutes is probably too long to generate a high quality AO texture on the fly and we have to consider slower computers (mine can handle about 8 threads at a time) I don't see that we need a lower quality GPU approximation, though it might be nice to see how it looks in practice for a comparison. I was wondering if we couldn't do the actual raytracing algorithm on the GPU since they are highly parallel by nature. Quote Link to comment Share on other sites More sharing options...
Sonarpulse Posted July 13, 2012 Report Share Posted July 13, 2012 regarding murkiness: Yay! i guessed right!@historic_bruno Do you mean have blender use the gpu? or use the gpu for the lower alternative? I don't know blender, but if you can give it a script from the command line, this seems the type of thing that would easily be added to the build system. Even a straight up makefile would probably work. Quote Link to comment Share on other sites More sharing options...
myconid Posted July 13, 2012 Author Report Share Posted July 13, 2012 (edited) Several minutes is probably too long to generate a high quality AO texture on the fly and we have to consider slower computers (mine can handle about 8 threads at a time) I don't see that we need a lower quality GPU approximation, though it might be nice to see how it looks in practice for a comparison. I was wondering if we couldn't do the actual raytracing algorithm on the GPU since they are highly parallel by nature.I know proper GPU raytracing can be done with OpenCL... though it's tricky to do with GLSL shaders.For raytracing you need access to your entire model, so for each point you can cast a bunch of rays and check if they collide with any other parts of the model. Shaders only have local info about the triangle they are currently rendering, so obviously that's a problem.Assuming we don't want to use the shadowmapping method and we want to try real GPU raytracing, I've been thinking about what kind of algorithms we can try. The good thing about AO calculation is that we don't care about the colour of each ray, just whether it shoots into the sky.One possible solution is to first render the model into a 3d texture (on either CPU or GPU) and then do the actual tracing of rays by "walking" through the texture on the GPU. This alone may be enough for our purposes, but this paper goes a step further and passes in a data structure (stored in a texture) with the triangle data that occurs in each voxel, and thus calculates exactly what the ray hits.A 2563 3d texture is 16MB. 5123 is 128MB. Seems totally feasible, I think... but we'll have to try it to be sure. Edited July 13, 2012 by myconid Quote Link to comment Share on other sites More sharing options...
zoot Posted July 13, 2012 Report Share Posted July 13, 2012 I didn't want to spam the art thread with debug info, but I currently do not see any foam/surf on the latest commit on wraitii/waterShader, though I did previously. fancywater and superfancywater are both on. Quote Link to comment Share on other sites More sharing options...
plumo Posted July 13, 2012 Report Share Posted July 13, 2012 (edited) What this project ( I mean 0 AD in general) really needs is a weekly report 'the week in review' (or sth alike)See the open morrowind project: http://openmw.org/en/There is so much amazing work being done, the community would love to read about it. Edited July 13, 2012 by plumo Quote Link to comment Share on other sites More sharing options...
Pureon Posted July 13, 2012 Report Share Posted July 13, 2012 What this project ( I mean 0 AD in general) really needs is a weekly report 'the week in review' (or sth alike)Our new website (when it's finished) will have team member blogs and such. I'm sure trusted folks such as yourself would be able contribute in one way or another. Quote Link to comment Share on other sites More sharing options...
Wijitmaker Posted July 14, 2012 Report Share Posted July 14, 2012 Out of curiosity, how did you make that map Wijitmaker?Its kind of tedious, you basically remake the entire texture with lots of gradient work. Lets see how this works out. Next up will be a specular and light map for it. Quote Link to comment Share on other sites More sharing options...
myconid Posted July 14, 2012 Author Report Share Posted July 14, 2012 https://github.com/myconid/0ad/tree/effectdistanceI'm skeptical whether this is the best solution... We should be able to get better results by doing this through the material files instead of the effects files. Quote Link to comment Share on other sites More sharing options...
myconid Posted July 14, 2012 Author Report Share Posted July 14, 2012 Its kind of tedious, you basically remake the entire texture with lots of gradient work. Lets see how this works out. Next up will be a specular and light map for it. I'll give this a try! Btw, have you considered using this heightmap with the "displace" modifier in Blender? Maybe we could bake more detailed AO maps that way, and you could use the sculpting tools to improve your results. Quote Link to comment Share on other sites More sharing options...
wraitii Posted July 14, 2012 Report Share Posted July 14, 2012 (edited) Fastest way to me would be:Create a heightmap using CrazyBump (from the texture). Start up Gimp/photoshop/whatever and quickly fix the most obvious problems (color inversion…). Load the model in blender, tesselate/subsurf, displace using said heightmap, paint the texture to fix the problems (live in Blender, I mean), save texture, apply the modifier and bake the normals in Blender (using one of many tutorials). Then merge these two files in Gimp/Photoshop/whatever. Edited July 14, 2012 by wraitii Quote Link to comment Share on other sites More sharing options...
myconid Posted July 14, 2012 Author Report Share Posted July 14, 2012 (edited) Its kind of tedious, you basically remake the entire texture with lots of gradient work. Lets see how this works out. Next up will be a specular and light map for it.Alright, here are two big screenshots:There are some tiling artifacts on the stone part of the roof, but otherwise this looks gorgeous.Download the attachments for the massive versions, if they'll be more helpful. Edited July 14, 2012 by myconid Quote Link to comment Share on other sites More sharing options...
Wijitmaker Posted July 14, 2012 Report Share Posted July 14, 2012 Cool, that did turn out pretty good. I see some fixes I need to make to the texture and the artifacts you mention (I'll need to modify the UV mapping on the model to fix that). I think there would be a big benefit to do some mapping to some of the things I avoided like the pediment, eagle, and statue too.Q, does the AO generator take into account the normal maps? Quote Link to comment Share on other sites More sharing options...
myconid Posted July 14, 2012 Author Report Share Posted July 14, 2012 Alright, I've now implemented effects that can disable themselves with distance. It's done through the materials files and controlled from the config without hardcoding anything. Instead of using "define" to set up effects in the materials, we can use "conditional_define" that looks like this:<conditional_define name="USE_PARALLAX_MAP" value="1" type="draw_range" conf="parallaxdist"/>This tells it that we want the shaders to see a define of that name/value only when the "draw_range" condition type is true with the values it gets from the "parallaxdist" set of values in the config file. In the config, this will appear like thismaterialmgr.parallaxdist.max = 120i.e. parallax is enabled only when the distance to the model is up to 120 units away. If we set this to a value less than 0 (e.g. -1) the effect is always on. If the value is 0 then the effect is always off.Code: https://github.com/myconid/0ad/tree/effectdistance2 Quote Link to comment Share on other sites More sharing options...
myconid Posted July 14, 2012 Author Report Share Posted July 14, 2012 Cool, that did turn out pretty good. I see some fixes I need to make to the texture and the artifacts you mention (I'll need to modify the UV mapping on the model to fix that). I think there would be a big benefit to do some mapping to some of the things I avoided like the pediment, eagle, and statue too.You could look at how the automatically-generated normalmap worked around that issue. Afaik, this wasn't a problem with that.Q, does the AO generator take into account the normal maps?In Blender, no. We'd need to explicitly turn the heightmap into geometry for it to affect the AO. Quote Link to comment Share on other sites More sharing options...
wraitii Posted July 15, 2012 Report Share Posted July 15, 2012 Seems like it would be working great, Myconid. Basically, you switch shaders on the fly? Quote Link to comment Share on other sites More sharing options...
myconid Posted July 15, 2012 Author Report Share Posted July 15, 2012 Seems like it would be working great, Myconid. Basically, you switch shaders on the fly? Yeah, something like that.What's left to do is to somehow pass the config values into the shaders, so they know when to fade themselves out. This can probably be done using defines. Quote Link to comment Share on other sites More sharing options...
myconid Posted July 15, 2012 Author Report Share Posted July 15, 2012 Ok, done with the effects distance. Unrolled GLSL loop and using the new system with it, with 2 different quality levels. I haven't checked the stats, but it definitely feels like it's faster now!wraitii, when you get a chance see if this works with your ARB shader. fabio, if you're still looking at this thread, can you check if the updated parallax effect works on your X1600? Quote Link to comment Share on other sites More sharing options...
wraitii Posted July 15, 2012 Report Share Posted July 15, 2012 I'll try to finish the water stuffs (notably waves) first, and then port everything else to ARB, I'll check at that time, but there's no reason to imagine it wouldn't work. Quote Link to comment Share on other sites More sharing options...
fabio Posted July 15, 2012 Report Share Posted July 15, 2012 fabio, if you're still looking at this thread, can you check if the updated parallax effect works on your X1600?I can test in the following days. It's on git at https://github.com/myconid/0ad/branches ? Which branch? Quote Link to comment Share on other sites More sharing options...
myconid Posted July 15, 2012 Author Report Share Posted July 15, 2012 I'll try to finish the water stuffs (notably waves) first, and then port everything else to ARB, I'll check at that time, but there's no reason to imagine it wouldn't work.I can test in the following days. It's on git at https://github.com/m...id/0ad/branches ? Which branch?There's no hurry, test whenever you have time. The branch is "effectdistance2". Quote Link to comment Share on other sites More sharing options...
Mythos_Ruler Posted July 15, 2012 Report Share Posted July 15, 2012 This grass effect. If it's too slow for terrain, what about applying it to a farm field decal and use the feature for nice-looking 3-D farms that conform to the terrain grid? Quote Link to comment Share on other sites More sharing options...
myconid Posted July 15, 2012 Author Report Share Posted July 15, 2012 This grass effect. If it's too slow for terrain, what about applying it to a farm field decal and use the feature for nice-looking 3-D farms that conform to the terrain grid?At the very least, that would give me an excuse to implement fancy materials for decals. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.