Wirehead Studios

Wirehead Modifications => General Development ('Laced Neptune') => Topic started by: leilei on 2016-03-27, 17:41

Title: tr_ Matrix help
Post by: leilei on 2016-03-27, 17:41

I like to toy with the renderer very much (https://github.com/OpenArena/engine/commits/master) and currently i'm trying to implement a software tcGen of GL_EYE_LINEAR which would, in theory, map the UV's from the viewport's projection (which could make for nice fake framebuffer effects like refractions/reflections if gone a little further)

Only problem is i'm having trouble translating matrixes from the projection to the world.  Q3 doesn't come with much functions for matrix manipulation, and code on the internet to imitate GL_EYE_LINEAR (like for GLES) really calls for them.

I *could* DoTheRightThing and use a FBO...but i'm intentionally targeting the low end, the ~2000 target for technical and aesthetic reasons, among other plans like libretro. :)

I was inspired by this (http://www.nvidia.co.uk/object/demo_cave.html) which pulls off refraction by GL_EYE_LINEAR'ing a pass with a rendertotexture of the view before drawing the water. The reflection is a static cubemap and the ripples are the standard procedural heightmap though.

Title: Re: tr_ Matrix help
Post by: Phoenix on 2016-03-27, 21:41
I wish I could help there, but I'm not very familiar with OpenGL commands, nor matrix calculations.  Vorlonesque is a lot more familiar with the engine.  I'll bug him on Steam sometime to see if he can provide some input.