Jump to content

What is the right way to show out an original texture


photo

Recommended Posts

Posted
Hi
 
I wrote a .mat with two shader files .vert and .frag. Acturally my demand is quite simple: create a rectangle mesh with the customized material, which is supposed to show out what the original texture exactly is. 
This is the .frag file:
#include <core/shaders/common/fragment.h>

INIT_TEXTURE(0, TEX_COLOR)// Adds a texture sampler

// Input data struct
STRUCT(FRAGMENT_IN)
 INIT_POSITION    // Projected position
 INIT_IN(float4,0)   // Texcoord (uv)
END

MAIN_BEGIN(FRAGMENT_OUT,FRAGMENT_IN)

 float4 texcoord = IN_DATA(0);// Get the UV coords  
  
 OUT_COLOR = TEXTURE(TEX_COLOR,texcoord.xy);// Get the texture data 

MAIN_END

For some reasons, the outcome is kind of similar to the original texture, but not exactly the same. I have already skipped all the post processing effects (render_skip_post_materials 1). Seemingly a gamma correction has been done by the engine. I Modified the .frag file like this: 

MAIN_BEGIN(FRAGMENT_OUT,FRAGMENT_IN)
  
// OUT_COLOR.rgb = 0.f; 
// OUT_COLOR.rgb = 0.01f; 
// OUT_COLOR.rgb = 0.1f; 
// OUT_COLOR.rgb = 0.5f; 
// OUT_COLOR.rgb = 0.95f; 
 OUT_COLOR.rgb = 1.0f; 
MAIN_END

The follow check list illustrates the pixel values between input and output:

 
0.000f->0.000f
0.010f->0.121f
0.100f->0.349f
0.500f->0.658f
0.950f->0.976f
1.000f->1.000f
 
Is there a gamma correction done by engine?
 
Thanks!
  • 3 weeks later...
Posted

Could somebody give me any suggestion?Thanks in advance.

Posted

Hi Silent,

 

We are also looking for the similar kind of feature.

Where all the world will take all lighting and shadows and other effects. But some nodes... Probably a plane with some texture will not take anything and will render as it is.

 

We need this to support chroma keyed textures from  our engine to be merged into Unigine scenes. But we are not able to judge the chroma quality as rendering changes everything when we merged this texture to Unigine.

 

Please help.

 

Posted

Hi Rohit,

There is no easy way to achieve that. Exposure and post processing are always applied at the last and will always change the final picture.

 

If you will disable automatic exposure, all the post-processing and will do the following steps for the material that you want to display as-is you should be able get the original texture.

 

Thanks!

How to submit a good bug report
---
FTP server for test scenes and user uploads:

×
×
  • Create New...