0

I want to render a few 3D models, to be concrete cards (but should have 3 dimensions) with different values on the front-side.

To accomplish this I thought it would be a good idea to create a model which represents the dimensions and form of a card, if possible already supply a default-texture for the card and add card-specific values like a number different for every rendered model.

I'm already able to load the model with default-texture and render to screen, but I don't have any clue how to add the dynamic texture to the front-side of the model.

4

2 回答 2

4

为每种卡片类型创建一个 TextureAttribute,然后将其设置到每个模型实例的材质中:

TextureAttribute textureAttribute1 = new TextureAttribute(TextureAttribute.Diffuse, yourtexture);

//

material = modelinstance.materials.get(0);
material.set(textureAttribute1);`
于 2013-06-16T21:38:16.073 回答
0

您可能在很久以前就已经解决了这个问题,但是在模型的正面放置纹理取决于您在建模软件中创建的 uv。因此,如果您将正面 uvs 与侧面 uvs 分开在一个单独的岛上,那么这将是您的数字之一。例如,如果有 4 个 uv 岛,您的纹理将从 0 变为 3。所以您的正面将是这些数字之一。但是,必须正确解开模型才能使其正常工作。

您还必须添加一个多/子纹理并为每个纹理编号。只有这样,您才会在每一侧看到不同的纹理。我唯一没能做的就是正确缩放纹理。

于 2020-05-05T15:51:28.867 回答