X3D textures

Discussion in 'General Discussion' started by 510440_deleted, Sep 19, 2014.

  1. I seem to have a problem with my x3d textures when uploaded in Shapeways. I use an x3dom viewer to view my x3d file, which is a surface with an elevation, and everything seems normal but once I load it into Shapeways and view it with its material, the texture is not aligned with the shape vertexes anymore. For some strange reason, the alignment works fine when the base surface is square...

    My initial x3d works as such:

    <Shape>
    <Appearance>
    <Material diffuseColor='1 1 1'></Material>
    <ImageTexture url='myImageUrl'></ImageTexture>
    </Appearance>
    <IndexedFaceSet solid='true' creaseAngle='1.5' coordIndex='myCoordIndexes' ccw='true'>
    <Coordinate point='myCoordPoints' DEF='mainShape'/>
    </IndexedFaceSet>
    </Shape>

    Since the mapping is trivial, ie every UV maps to every XY, I don't specify the texture mapping. This works fine in my x3d viewer but not in the Shapeways one.
    Question: do I need to specify the texture mapping?
     
  2. UniverseBecoming
    UniverseBecoming Well-Known Member
    I'm cannot envision what you are saying based on your description. Can you post some screen captures so it is easier to understand the problem you're having?
     
  3. mkroeker
    mkroeker Well-Known Member
    Check the IndexedFaceSet for errors - shapeways' software may have seen a need to add or remove vertices, which would destroy the one to one mapping of the texture.
     
  4. I attached two screenshots showing the differnce between what I get with my application and what I get from Shapeways after uploading.

    Thanks!

     

    Attached Files:

  5. mkroeker
    mkroeker Well-Known Member
    Try loading your x3d file in netfabb studio basic to check the quality of the mesh. Small gaps or overlaps in the surface may not be apparent in your x3d viewer.
     
  6. Thanks. I tried and the model is fine. I also tried with other viewers like SwView and the model comes up perfectly. I suspect there is an X3D implementation difference somewhere. I don't specify the texture coordinates, may be it is an issue for the Shapeways parser?
     
  7. mkroeker
    mkroeker Well-Known Member
    Something for shapeways' programmers to answer, I guess...
    Can you provide an example ?
     
  8. Yes, how do you contact them?

    Attached is an example.
     

    Attached Files:

  9. mkroeker
    mkroeker Well-Known Member
    One of the regulars from shapeways staff (Mitchell and "YouKnowWho4Eva") will forward it to them if none of them happens to be active in the forum anyway.
    I just loaded your model into view3dscene - it complained about your X3DTextureCoordinateGenerator node having a "parameters" attribute instead of the standard spelling "parameter", but fixing this did not improve the model. (I do not see distortion in the mountain range, but the model is uniformly
    blue with what could be the back of the legend on the underside. Loading the x3d into netfabb studio basic gives me the warning triangle - "Surface is closed: No" and both surface area and volume are huge numbers. Running the automatic repairs (and applying the result) and rescaling by 0.00001
    seems to approve matters considerably - now the texture is clearly visible in view3dscene. I will try an upload now and add the fixed model here if
    successful.
     
  10. UniverseBecoming
    UniverseBecoming Well-Known Member
    I took a look, but without seeing the original it's hard to say what Mesh Medic is doing to it. Have you tried creating a relief map of a different area with the software to see if the same error occurs?
     
  11. UniverseBecoming
    UniverseBecoming Well-Known Member
    Oh! I see I see. So this was the original data. That square in the pacific ocean through me off. If Mkroeker hasn't fixed it I can retexture it in Zbrush if this is a one off that you're needing.
     
  12. mkroeker
    mkroeker Well-Known Member
    Basically fixed, it is just that my downscaling was a bit too aggressive.
     
  13. I tried various areas, same issues.
    It works OK when the map shape is square, then the image texture maps the shape fine. It's as if the image was stretched to a square before being applied to the mesh.

    The idea is to be able to generate any area of teh world that I want, so it's a can't be a one off fix, but thanks anyway!
     
  14. UniverseBecoming
    UniverseBecoming Well-Known Member
    Oh, so you're the developer I take it. If that's the case, nice work so far! :D
     
  15. AlanHudson
    AlanHudson Shapeways Employee Dev Team
    We do not support the TextureCoordinateGenerator node. If you remove that then you'll end up using the standard texture coordinates geneated for an index face set. If that works for you then great, if not then you'll need to provide explicit texture coordinates at each vertex.

     
  16. Hi Alan,

    Initially I tried without the TextureCoordinateGenerator. The couple of viewers I use automatically assign the imagetexture to the shape vertexes with all corners matching. It seems the Shapeways one matches the bottom corners of the shape and then uses the same increment on both U and V. This is my guess as to why it works for square images and streches the other ones. Personally, unless mistaken, I don't think this is the "normal" behavior, not sure what the spec say on this (probably nothing).

    From there I have two options (1) use a texCoord and TextureCoordinate, for a full res 3d model this will add > 1M indexes and as many pair of floating values, but the models are already large so... (2) square the image used for the texture. This will probably introduce some additional distortions in the image and increase the image size as well...

    I'll probably go for (1) unless you have another suggestion.
     
  17. Actually, looking at the specs again:

    If the texCoord field is NULL, a default texture coordinate mapping is calculated using the local coordinate system bounding box of the shape. The longest dimension of the bounding box defines the S coordinates, and the next longest defines the T coordinates. If two or all three dimensions of the bounding box are equal, ties shall be broken by choosing the X, Y, or Z dimension in that order of preference. The value of the S coordinate ranges from 0 to 1, from one end of the bounding box to the other. The T coordinate ranges between 0 and the ratio of the second greatest dimension of the bounding box to the greatest dimension.

    So it's normal behavior then... I need to do the texture mapping as you suggested.