ovilab / atomify

Atomify - a realtime LAMMPS visualizer
GNU General Public License v3.0
149 stars 20 forks source link

Why do we package positions with deferred rendering? #413

Closed andeplane closed 6 years ago

andeplane commented 6 years ago

In deferred rendering, we pack the position in the g buffer like this: positionOut = vec4((position-eyePosition-posMin) / deltaMaxMin, 1.0); // TODO fix with actual system size

and unpack it in FinalQuadEntity: vec3 position = eyePosition + posMin + texture(positionTexture, texCoord).xyz * deltaMaxMin;

I checked in the Qt3D deferred rendering example, and they simply use the object's position. I tried that in Atomify also and did not see any artifacets. Did we falsely assume that textures had to have values in the range [0, 1]?

dragly commented 6 years ago

Hm, good question. I think that must have been the case, yes. If it works without it, then we might as well remove the extra complications.