Home Technical Talk

cubemaps and uv seams

polycounter
Offline / Send Message
rollin polycounter
hey ho,

I want to display a cubemap in ogre on a mesh

in the shader it looks like this

float3 viewReflectionVec = normalize(reflect(-Input.CamVec, bumpNormal));
float4 mysupercubereflection = texCUBE(EnvironmentMap, viewReflectionVec);




Problem is that I get a visual break in the cube reflection at every uv seam.

on a sphere where every uv-edge is split it looks like that



discokugel_0000.jpg


edit: ok this is not right.. I need some space between the split uv chunks to make the seam visible.. some intern welding?!

Am I stupid or is this how cubemap reflections work?!

Replies

  • rollin
    Offline / Send Message
    rollin polycounter
    btw.. I get it working with an shader fx shader.. though the problem occurred on one instance of the test mesh and I can not figure out what's wrong there.. Normals are the same, textures are the same, smoothing groups.. 0.o

    edit: ok it gets even more strange.. I get seams at a cylinder but there are not uv seams and just one smoothing group... wtf

    edit2: ok this one is fixed.. it was ogremax and the setting "merge duplicate vertices" fixed it
    So the summary till now: why do I see the uv edges in ogre but not in max
    Btw.. rotating the uv's by 90° changes the intensity I see horizontal or vertical the borders
  • Brice Vandemoortele
    Offline / Send Message
    Brice Vandemoortele polycounter lvl 19
    Screenshots would help...

    But here's a few thoughts:

    - if the boundaries of the facets and the faces of your mesh match, why use a normal map? The problem would then be extremely simple on the shader side (and making it 'uv independent').

    -if they don't and you use a normal map, why not storing every facet information in it? You then need to instantiate a highres facet on the surface of the sphere and bake everything at once.
  • rollin
    Offline / Send Message
    rollin polycounter
    ok here is an image showing the effect.

    The problem seems that there is a slight difference how the cube pixels are calculated and if then a bright and a dark spot of the cube moves over the seams you get something like this:

    uvseemsandcubemap.jpg
  • Farfarer
    I've had strange results in Unity with cubemaps and other similar stuff.

    In the end I had to normalize the viewDir inside of the fragment shader before calculating the reflection vector.

    It's an extra normalize, which sucks, but it fixed the problem.
  • rollin
    Offline / Send Message
    rollin polycounter
    tried this but no luck.

    The problem even appears if you create a sphere in max, mirror one half of the uvs onto the other half and put an direct x shader with cubemap support on it.

    Use a pure empty normalmap as test.

    As soon as you mirror the uvs the whole cubemap thing moves a tiny bit.

    uvseemsandcubemap3.jpg



    and this gets ugly on more complex parts of the model

    uvseemsandcubemap2.jpg
  • rollin
    Offline / Send Message
    rollin polycounter
    ok somehow this whole thing was composed out of two totally independent things.

    The problem in the first image is now fixed (image taken from the ogre engine) as I had calculated the cubemap from tangent vectors what was quite super stupid. (correct would be to use would space vectors)

    but the error in the 2nd and 3rd image are from max with xoliul shader (1.6) and also with my own toon shader.

    So this seems to be a strangeness from max not connected with my initial problem.
Sign In or Register to comment.