Archived

This topic is now archived and is closed to further replies.

voodoo_john

OpenGL Thermal / Night Vision in OpenGL using Shaders

Recommended Posts

voodoo_john    140
Hi all, I''m an old man trying to learn new tricks. Recently I''ve began the process of introducing shaders to my engine using GL_ARB_VERTEX_SHADER. I don''t use CG at the moment because I''m doing a x-platform engine that must run on OS X. My questions is: using shader assembly, what would be the best way of doing a thermal or night vision viewing mode like in AVP2 say? I''m currently working on a Zombie game called ZOMBIE ISLAND an would like a night vision stylee mode, and infra-red/thermal one as well. Any help appreciated, John

Share this post


Link to post
Share on other sites
Robbo    122

Well, I guess you need alpha/temperature maps to use as textures - the values in these maps are then used to index into a palette texture. The palette texture would contain smooth gradations of colour.

Now, I''m interested in this myself because, ugh, I work for a Thermal Imaging company and we are planning on moving over to pixel shaders for our temperature map palettization.

If anyone knows what the resulting ps program would look like - well, feel free to plant it here first

Share this post


Link to post
Share on other sites
voodoo_john    140
I had thought along those lines, but that technique requires artists to have pre assigned temperature data to _every_ object in the scene. Surely this can be faked algorithmically? Does anyone know how they did it in AVP2 which has three separate vision modes?

Share this post


Link to post
Share on other sites
Eelco    301
well, i dont know much about pixel shaders, but if you could calculate the depth of the object at each pixel you could set the color to something corresponding with that value multiplied with the temperature of the object, i think that should work out pretty nice.

Share this post


Link to post
Share on other sites
voodoo_john    140
Aye, but again that would require artist intervention :-O I ain''t no artist....I''m sure there must be a way to fake it. Let''s forget characters just now, how would you have thermal vision for a world. You obviously wouldn''t want to assign temperature data to all objects in the world....

Anyone got any ideas about night-vision? In the recent thread on comemrcial source code, the source for Commanche Hookum seens to just blend a green quad over the screen...might give that a go :D


cheers !

Share this post


Link to post
Share on other sites
Guest Anonymous Poster   
Guest Anonymous Poster
An easy way to fake it.. "Light" the model with a light source at the camera''s location, and then map different light levels to a 1d color scale texture (where "dark" is dark blue and "bright" is red/orange) in a pixel shader. This way the center of the model will have a hot color that fades out toward the edges. Scale the brightness based on the temperature of the object, so eg. a stone object looks colder than a human. This is basically a variation of the "iridescent" rendering demo you can find at the NVidia site.

Now that I think about it, you could probably just do this with a spherical environment map with a red dot in the middle fading to blue towards the edges. Doesn''t even require shaders.

Share this post


Link to post
Share on other sites
Guest Anonymous Poster   
Guest Anonymous Poster
In spherical environment mapping, you generate texture coordinates based on the vertex normals. To put it simply, if a vertex (ie faces it connects to) is facing left you set the UV coordinates of the vertex to the left side of the texture, and if the vertex is facing the camera, the texture coordinates are somewhere in the middle. If the environment map texture is red in the middle and fades to dark blue on the edges, this will look a bit like "heat vision" especially if you blur the end result. (render to texture)

Share this post


Link to post
Share on other sites
Robbo    122

Well, I''m thinking you need temperature maps if you want to do this correctly (they would just be luminance maps) - speaking as someone who works for an infrared thermography company!

I''m not sure how they did things in splinter cell however, which is a pretty nice representation in my opinion. Don''t forget that luminance maps for things like walls/floors will be more or less background noise, with a some features - its the hot things, like people, lights etc. that need the maps.

Share this post


Link to post
Share on other sites
c t o a n    163
Well, yeah, you don''t really need maps for EVERY object in the scene... You can have some algorithmic way of determining the heat of a ''non-heat-generating'' object by simply using a blue texture with some noise added in to break up the monotony. Now, for heat generating objects, I believe you would need to do it manually. Otherwise, how would a computer know that a human''s eyes are ''hotter'' than their feet? And to fake this, I think it would still be really hard to pull it off without some artist intervention.

Chris Pergrossi
My Realm | "Good Morning, Dave"

Share this post


Link to post
Share on other sites

  • Similar Content

    • By povilaslt2
      Hello. I'm Programmer who is in search of 2D game project who preferably uses OpenGL and C++. You can see my projects in GitHub. Project genre doesn't matter (except MMO's :D).
    • By ZeldaFan555
      Hello, My name is Matt. I am a programmer. I mostly use Java, but can use C++ and various other languages. I'm looking for someone to partner up with for random projects, preferably using OpenGL, though I'd be open to just about anything. If you're interested you can contact me on Skype or on here, thank you!
      Skype: Mangodoor408
    • By tyhender
      Hello, my name is Mark. I'm hobby programmer. 
      So recently,I thought that it's good idea to find people to create a full 3D engine. I'm looking for people experienced in scripting 3D shaders and implementing physics into engine(game)(we are going to use the React physics engine). 
      And,ye,no money =D I'm just looking for hobbyists that will be proud of their work. If engine(or game) will have financial succes,well,then maybe =D
      Sorry for late replies.
      I mostly give more information when people PM me,but this post is REALLY short,even for me =D
      So here's few more points:
      Engine will use openGL and SDL for graphics. It will use React3D physics library for physics simulation. Engine(most probably,atleast for the first part) won't have graphical fron-end,it will be a framework . I think final engine should be enough to set up an FPS in a couple of minutes. A bit about my self:
      I've been programming for 7 years total. I learned very slowly it as "secondary interesting thing" for like 3 years, but then began to script more seriously.  My primary language is C++,which we are going to use for the engine. Yes,I did 3D graphics with physics simulation before. No, my portfolio isn't very impressive. I'm working on that No,I wasn't employed officially. If anybody need to know more PM me. 
       
    • By Zaphyk
      I am developing my engine using the OpenGL 3.3 compatibility profile. It runs as expected on my NVIDIA card and on my Intel Card however when I tried it on an AMD setup it ran 3 times worse than on the other setups. Could this be a AMD driver thing or is this probably a problem with my OGL code? Could a different code standard create such bad performance?
    • By Kjell Andersson
      I'm trying to get some legacy OpenGL code to run with a shader pipeline,
      The legacy code uses glVertexPointer(), glColorPointer(), glNormalPointer() and glTexCoordPointer() to supply the vertex information.
      I know that it should be using setVertexAttribPointer() etc to clearly define the layout but that is not an option right now since the legacy code can't be modified to that extent.
      I've got a version 330 vertex shader to somewhat work:
      #version 330 uniform mat4 osg_ModelViewProjectionMatrix; uniform mat4 osg_ModelViewMatrix; layout(location = 0) in vec4 Vertex; layout(location = 2) in vec4 Normal; // Velocity layout(location = 3) in vec3 TexCoord; // TODO: is this the right layout location? out VertexData { vec4 color; vec3 velocity; float size; } VertexOut; void main(void) { vec4 p0 = Vertex; vec4 p1 = Vertex + vec4(Normal.x, Normal.y, Normal.z, 0.0f); vec3 velocity = (osg_ModelViewProjectionMatrix * p1 - osg_ModelViewProjectionMatrix * p0).xyz; VertexOut.velocity = velocity; VertexOut.size = TexCoord.y; gl_Position = osg_ModelViewMatrix * Vertex; } What works is the Vertex and Normal information that the legacy C++ OpenGL code seem to provide in layout location 0 and 2. This is fine.
      What I'm not getting to work is the TexCoord information that is supplied by a glTexCoordPointer() call in C++.
      Question:
      What layout location is the old standard pipeline using for glTexCoordPointer()? Or is this undefined?
       
      Side note: I'm trying to get an OpenSceneGraph 3.4.0 particle system to use custom vertex, geometry and fragment shaders for rendering the particles.
  • Popular Now