Solidworks Texture Files
- Nov 14, 2016 - Include any appearances/decals applied to the file, ensuring that the texture of your files is not lost once you decide to make them come to life.
- To add an image texture pick the Add button, then select the folder: 'C: Program Files SolidWorks Corp SolidWorks data Images textures'. Note your file path may be slightly different from this depending on how you installed SolidWorks 2010.
Discover SOLIDWORKS Tutorials, one of many SOLIDWORKS Resources. Access a wide range of video tutorials, in-product tutorials, PDF guides, project files, and video clips—designed to help you become a top SOLIDWORKS user.
At the moment I am engaged in creation SolidWorks add-in for exporting 3D models in OBJ format .
OBJ is opened and very simple format
I've googled and found out the following information about existing solutions: there are several paid plugins and 1 free, which is called 'Free OBJ Exporter'
It was taken as a basis. But it does not export the decals.
Decals are images you draw on top of the main texture ( if you move away from the context of SolidWorks, in 3D programming it's like a marks of bullets , blood drops , etc.)
Export decals are an important part of the project.
I rewrote all the VBA code into C #.
And now I come to grips with the issue of export decals . Documentation Solidworks API rather poor.
Solidworks Texture
After a week of reading the documentation and a couple of questions on LinkedIn I found the following :
IDecal
is inherided class from IRendererMaterial
. Therefore I can get a list of all the decals and get the following information:
- Yposition
- Xposition
- Width
- Height
I also can get a list of IFace2 objects and get FaceDecalProperties
.IFaceDecalProperties
provides next information:
TextureTranslationU
TextureTranslationV
TextureTranslationX
TextureTranslationY
TextureUScale
TextureVScale
What it is, what it stands for and how to use it I do not know .
OBJ format does not support directly decals.
When you buy an AutoCAD LT suscription or rental with us, you get the same AutoDesk product, the same support from AutoDesk - but you also have us to help with any queries, purchase issues and to make purchasing and renewal as easy as possible. More support, more interaction, more communication and more payment choice. Quite simply, because you get more.
How can I use this parameters for concatenation texture and decal in one file? I want to do it for rendering decal on face and solve the problem of Z-fighting, because I don't have source code of renderer.
1 Answer
I'm not sure what TextureTranslationX and TextureTranslationY mean in this context, but TextureTranslationU and TextureTranslationV almost certainly refer to the texture coordinates of the model.
Typically the (U,V) texture coordinates are specified between [0,1] and determine how an image is mapped onto a surface. (U,V) = (0,0) will typically be the top leftmost pixel of the texture image.
So if you have a set of vertices like:
Which defines a square in (X,Y,Z) space, and these vertices have the following (U,V) texture coordinates:
Then a 'texture', by which we really mean image, will be applied to the square such that its top leftmost pixel will be applied to the (0, 0, 0) vertex of the square. Emergency 4 winterberg configurator.
TectureUScale and TextureVScale likely refer to scaling parameters that allow for non-rectangular texture images.
In terms of translating this to OBJ, consult http://en.wikipedia.org/wiki/Wavefront_.obj_file. The format I used above is consistent with the file format specification.
You will also need to save the texture image to a .tga file according the documentation and then create a .mtl file that looks like:
The final piece is to put:
Before the vertex and texture coordinate definitions in your .obj file.
I would start out with something very simple like a square textured with a checkerboard pattern that has the same width and height.