Hello all,
I've started taking a look at the WME sources with a view to trying to implement some features that I feel could make a huge difference to the visual appeal of the game.
But, I'm having a bit of trouble finding my way around the source code so I was wondering if anyone could help point me in the right direction
Let me just outline my thinking about these features;
- Post-processing shaders would allow a huge variety of visual effects to be easily plugged into WME games, and make a huge difference to the look and feel of 2D and 2.5D productions alike.
- Resolution independence could actually be achieved
through the same system. I am thinking that the engine would need to render everything to a render target the same size as the default resolution of the game, instead of direct to the viewport (unless I am mistaken and this is already happening or at least easily possible). Then, this render target can be drawn to the screen with a shader that will scale and crop it to the actual screen resolution. This means I could develop my game for 1080p resolution but scale it down for lower-res displays. It's a shame to be confined to lower resolutions in this HD age, just so my game can be widely compatible!
- This would make it fairly easy to add fine control of effects like zoom & pan. I would also prefer to implement widescreen by designing for widescreen res, then have the game crop the left and right extremeties and pan the scene, rather than introducing black bars, so it will always occupy the entire viewport
- The render target could be redrawn with a chain of post-process shaders to allow any combination of effects
- It would be amazing to be able to render individual 2D sprites with shaders. This is effectively
the same operation as drawing the rendertarget to the screen with a post-process filter. The rendertarget in that case would just be a full-screen sprite. I am just thinking here about code reuse and the fact that this could all be done in a (relatively) straightforward way once the basics are in place.
- I've already written a variety of 2D sprite and post-process shaders from a side project I started in XNA. These include: motion blur, glow and outline, colour cycling, distortion mapping, plasma beams, and a couple others. So this would be a nice library of effects I could instantly make available to other Wintermute users along with the modified source of course! Colorisation, brightness/contrast, and simple blur effects would also be pretty straightforward. There really are no limits to what you can achieve once you start playing around with HLSL
So; firstly, I do a lot of work in C#, and although many years ago I dabbled in C++, I'm a bit rusty which is where I'm struggling here.
My questions are:
1. Through the C# wrapper API are there any ways it's possible to manipulate the rendering system? (I'm assuming not)
2. Where exactly in the code are shaders being applied to 3D models?
3. Where exactly in the code are 2D sprites getting rendered?
4. Is everything being rendered direct to the display, or is it going to a rendertarget first anyway? If so, where does this get finally rendered to the display?
This will undoubtedly not be the whole story, but these pointers would really help me understand how the code fits together. I think this additional flexibility in the engine would truly mean that "anything is possible" in Wintermute and I've certainly seen other requests in the forums for these kind of features. It would for me remove all important limitations of the engine whilst we wait for the WME 2 release
Any help much appreciated,
Pete