openexr-user
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Openexr-user] opaque colors


From: Drew Hess
Subject: Re: [Openexr-user] opaque colors
Date: Tue, 25 May 2004 09:19:20 -0700 (PDT)

You don't say how you're creating the cube map texture, but if you're
setting it up as a 16-bit int texture using the 16-bit float values from
your OpenEXR cube map, that could easily explain your washed-out textures.  
In OpenGL, 16-bit integer pixels are normalized from 0->1.0 (e.g., 0 == 0
and 2^16-1 == 1.0).

If you want OpenGL and your fragment program to interpret the OpenEXR
pixel values correctly, you need to create the texture using the
NV_HALF_FLOAT extension; see ImageViewFragShader.cpp in the exrdisplay
source for how to do this.

I'm not familiar with OpenSG (I mean, I've heard of it, but I've never
used it) so I'm not sure what is preventing you from using 16-bit floats.  
It's OK to store the 16-bit floats as 16-bit ints as long as you use a
pointer cast so that the compiler will not attempt to convert the 16-bit
float values to 16-bit integers, but at some point you have to tell OpenGL
that your pixel data is NV_HALF_FLOAT.


-dwh-


On 25 May 2004, Enrico Borrione wrote:

> hi all,
> i am working on a little application using exr cube maps. 
> The 3D part works via opensg, a graphic library built on top of opengl.
> This is my problem: I correctly load the exr image in half format.
> Since opensg has no support for 16bit floats, i store the pixels as 16
> ints.
> After that loading, in the rendering part, i use a fragment program to
> process the pixel, adding exposure and other stuff (actually the same
> tonemapping used in the exrdisplay program.)
> now my sphere is textured and the exposure works, thou the colors have
> lost all the brightness, looking all grayish and giving the impression
> the the ball is covered in dust. If i turn on also the gamma correction
> computation the problem hardens and the sphere is almost in grayscale.
> I'd send a jpg of the sphere but i dunno if it is allowed, so better ask
> first...
> 
> my fp looks like:
> 
> # Fragment Params
> PARAM exposure = program.local[0];
> PARAM one_over_gamma = {0.4545,0,0,0};
> #middle gray with no gamma corr
> PARAM middle_gray = {0.0883,0.0883,0.0883,1.0};
> 
> # Fragment inputs
> ATTRIB inTexCoord = fragment.texcoord;      # First set of texture
> coordinates
> ATTRIB inColor    = fragment.color.primary; # Diffuse interpolated color
> 
> 
> # Fragment outputs
> OUTPUT outColor   = result.color;
> 
> TEMP texelcolor;
> TEX texelcolor, inTexCoord, texture[0], CUBE;
> 
> TEMP texelColor,luminance, m_exp, t_exp, temp_inColor, temp_outColor,
> temp_inColor2, outColor2;
> TEX texelColor, inTexCoord, texture[0], CUBE; 
> 
> ADD t_exp.x, exposure.x, 2.47393;
> EX2 m_exp, t_exp.x;
> MUL temp_inColor2.xyz, texelColor, m_exp.x;
> 
> POW temp_outColor.x, temp_inColor2.x, one_over_gamma.x;
> POW temp_outColor.y, temp_inColor2.y, one_over_gamma.x;
> POW temp_outColor.z, temp_inColor2.z, one_over_gamma.x;
> 
> #don't use the gamma, otherwise all the colors become gray...
> #MUL outColor, temp_outColor, middle_gray;
> MUL outColor, temp_inColor2, middle_gray;
> 
> END
> 
> now where can possibly hide the problem? maybe in the half/int parsing? 
> i dunno much of tonemapping tecniques, so finding the error it's a bit
> tricky for me...
> thx enrico
> 
> 
> 
> _______________________________________________
> Openexr-user mailing list
> address@hidden
> http://mail.nongnu.org/mailman/listinfo/openexr-user
> 
> 







reply via email to

[Prev in Thread] Current Thread [Next in Thread]