How to apply a texture to an object made using extrusion

MiguelD

I can apply without problems a texture to an object made using indexedfaceset but when i try to apply a texture to an object made using extrusion its like the faces of the object are not there. Example:

enter image description here enter image description here

figure on the left is the result applying normal colors, and on the right applying the texture.

Here is the code when applying the textures:

<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <title>Castle</title>
    <script type='text/javascript' src='x3dom-full.js'>
    </script>
    <link rel='stylesheet' type='text/css' href='x3dom.css' />
</head>
<body>
<x3d width="512px" height="512px">
    <scene>
        <switch whichChoice="-1">
            <extrusion id="wall" convex="true"
                       crossSection="
                      -1 -0.5
                      -0.7 -0.4
                      -0.4 -0.35
                      0 -0.3
                      0.4 -0.35
                      0.7 -0.4
                      1 -0.5
                      1 0.2
                      0.7 0.3
                      0.4 0.35
                      0 0.4
                      -0.4 0.35
                      -0.7 0.3
                      -1 0.2
                      -1 -0.5"
                       spine="
                       0 -1 0
                       0 0 0"
                       scale="
                       1 1
                       1 1">
            </extrusion>
        </switch>
        <transform translation="0 0 0" scale="1 1 1">
            <shape>
                <Appearance>
                    <ImageTexture url="castle_walls.jpg">
                    </ImageTexture>
                </Appearance>
                <x3dgeometrynode use="wall"></x3dgeometrynode>
            </shape>
        </transform>
    </scene>
</x3d>
</body>
</html>

Any help would be appreciated.

Holger Seelig

Texture coordinates are automatically generated by Extrusion nodes. Textures are mapped so that the coordinates range in the U direction from 0 to 1 along the crossSection curve (with 0 corresponding to the first point in crossSection and 1 to the last) and in the V direction from 0 to 1 along the spine curve (with 0 corresponding to the first listed spine point and 1 to the last). If either the endCap or beginCap exists, the crossSection curve is uniformly scaled and translated so that the larger dimension of the cross-section (X or Z) produces texture coordinates that range from 0.0 to 1.0. The beginCap and endCap textures' S and T directions correspond to the X and Z directions in which the crossSection coordinates are defined.

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

How is a JSON object made into an array using JQ?

How to apply a texture to part of a face?

How to apply texture to text with a shadow

How to apply changes made by fdisk

Unity: Apply shader to object to curve its texture

How to split and image through an image coming from a web source and apply them through a texture on a threejs object?

How to define the area of the texture to apply to a face

How to apply a texture from a picture to a text

How to apply to each side of DodecahedronGeometry a unique texture?

How to put a texture on object in OpenGL?

How to apply ArrayAdapter parameters as programatically made layout?

three.js apply texture on object face without interruption

opengl texture is one color made from texture

How to load Multiple 2D Texture in a single 3D Object in ARCORE Using OpenGL

How to add specular map,bump map and colour texture in one object using x3d?

How to change the texture of object at run time on button click in unity by using AR camera

How to read colored object in excel using python and apply formula?

How to apply filter for multiple layers when using object in JavaScript for ArcGis

How to assign an Array of Object property/method using a made-in-C# Type Library - COM-Interop?

How to cast Object to Texture in draw method?

How to reverse the direction of applying texture in the object CylinderGeometry?

How to bind texture just to one object in OpenGLES?

How to load .dae object with texture, and material

How to apply a texture to an imported GLTF model in three.js?

iOS+SceneKit: How to apply toon shader on texture?

How to apply a texture to a custom geometry in Three.js

How to remove texture applied to textpaint and apply hex color?

How to apply texture for .fbx model in three.js?

Image texture in SCNMaterial is always grey. How to apply color?