Texture mapping

Post here for help on using FreeCAD's graphical user interface (GUI).
Forum rules
and Helpful information
IMPORTANT: Please click here and read this first, before asking for help

Also, be nice to others! Read the FreeCAD code of conduct!
User avatar
dprojects
Posts: 721
Joined: Mon Mar 06, 2017 6:02 pm
Location: Poland
Contact:

Re: Texture mapping

Post by dprojects »

drmacro wrote: Sun Apr 03, 2022 3:00 pm The solids in the 3D view just turn black.
I see in your filepath there are spaces, so maybe the Texture Mapping tool collapse on that. Try to change the filename, replace the spaces with underscores and try again.

Thanks
Darek
github.com/dprojects

workbench for woodworking is available at: github.com/dprojects/Woodworking
drmacro
Veteran
Posts: 8864
Joined: Sun Mar 02, 2014 4:35 pm

Re: Texture mapping

Post by drmacro »

dprojects wrote: Sun Apr 03, 2022 5:29 pm
drmacro wrote: Sun Apr 03, 2022 3:00 pm The solids in the 3D view just turn black.
I see in your filepath there are spaces, so maybe the Texture Mapping tool collapse on that. Try to change the filename, replace the spaces with underscores and try again.
It appears it was a bad image. I got a an image from another source and it seems fine.

Thanks!
Attachments
Snip macro screenshot-398f84.png
Snip macro screenshot-398f84.png (414.73 KiB) Viewed 1719 times
Star Trek II: The Wrath of Khan: Spock: "...His pattern indicates two-dimensional thinking."
User avatar
dprojects
Posts: 721
Joined: Mon Mar 06, 2017 6:02 pm
Location: Poland
Contact:

Re: Texture mapping

Post by dprojects »

drmacro wrote: Sun Apr 03, 2022 6:55 pm It appears it was a bad image. I got a an image from another source and it seems fine.
Good !

I also played little bit with the coin.SoTexture2Transform() and I was able to scale the texture. So maybe there will be some improvements related to scale texture at my tool setTextures.

By default each Cube has the coin.SoTexture2Transform() and while I was trying to change it the Cube has been changed so there is need to add new coin.SoTexture2Transform() object and change it.

Thanks
Darek
github.com/dprojects

workbench for woodworking is available at: github.com/dprojects/Woodworking
User avatar
dprojects
Posts: 721
Joined: Mon Mar 06, 2017 6:02 pm
Location: Poland
Contact:

Re: Texture mapping

Post by dprojects »

Chris_G wrote: Sun Apr 03, 2022 4:06 pm You must insert a SoTexture2Transform node before your texture node.
Thanks, this is like you wrote, I added repeat X, repeat Y factors and also rotation Texture. I didn't tested so deeply but is working fine for now. I will be testing this more deeply next days.
I don't know why at FreeCAD the texture is usually applied only at 2 surfaces and all others are just lines, no pattern. Also the RootNode Coin has little strange structure. Why it need to be added like this? but this is probably subject for separate topic?

Thanks
Darek
github.com/dprojects

workbench for woodworking is available at: github.com/dprojects/Woodworking
UbunTux
Posts: 60
Joined: Fri Jan 25, 2019 12:11 pm

Re: Texture mapping

Post by UbunTux »

Hello
Trying out the setTextures macro for a curved model railroad backdrop.
Applied to a rectangular parallelepiped, it works for the large face.
But on a surface created with curves from an extruded sketch, the image is not distributed in the same way.
I tried with 90° rotations in the macro settings, but it seems to tilt the image backwards. And no effect on the curved face.
That's a shame. Looks like we're almost there though...
Image
Image
Image
User avatar
dprojects
Posts: 721
Joined: Mon Mar 06, 2017 6:02 pm
Location: Poland
Contact:

Re: Texture mapping

Post by dprojects »

UbunTux wrote: Fri Apr 22, 2022 5:23 pm
Yes, this how it works under FreeCAD. The Texture Mapping command from FreeCAD apply the texture with the same way (incorrect on some faces), you can see it at Cube as well.

There should be probably something with coordinates implemented but is not right now. Or some kind of texture per face, but I guess FreeCAD not allow to apply texture at face?

There is Arch Texture Workbench that allow to rotate and apply the texture as you probably wish. For woodworking purposes there is no such huge need to apply texture at edge because the wood panels are usually thick. So the texture bug is not so disturbing. Maybe in the future there will be some update with coordinates but for now it is not supported, sorry.

EDIT:

You can add FreeCAD file with these examples, so I will see if there is really not possible, because those elements are thick. Little strange the biggest surface has no texture correctly applied.

Thanks
Darek
github.com/dprojects

workbench for woodworking is available at: github.com/dprojects/Woodworking
UbunTux
Posts: 60
Joined: Fri Jan 25, 2019 12:11 pm

Re: Texture mapping

Post by UbunTux »

Thank you for these explanations.
The purpose of this plating is to carry out tests in order to match the background of a model railroad box with the decor (filament 3D printing, resin printing, plastic card and rolling stock, in place)
I made the background with 7 mm bendable plywood on which I will glue a photo print of a panorama made from a montage.
The tests allow me to agree the scales of the elements and their respective positioning.
Image
Image
Aim is to minimize trial runs from A4 prints in draft mode
Image

Panorama link used
https://i.servimg.com/u/f41/14/93/09/38/panomo11.jpg

Texture
https://i.servimg.com/u/f41/14/93/09/38/textur11.jpg
Le fichier
Decor.zip
(21.16 KiB) Downloaded 32 times

With the Arc workshop and the ArTextures addon, you can map a texture (image) onto an object.
Unfortunately; although having only one face in the U thanks to JoinCurves, the image does not map as it should..
Image

Here, that of the right-of-way. This is how the image is distributed.
Image

OS: Ubuntu 20.04.4 LTS (XFCE/xubuntu)
Word size of OS: 64-bit
Word size of FreeCAD: 64-bit
Version: 0.19.24366 (Git) AppImage
Build type: Release
Branch: (HEAD detached at 0f9259c)
Hash: 0f9259cda103ae1824ac16c68ac9b4a0d54b05fc
Python version: 3.9.7
Qt version: 5.12.9
Coin version: 4.0.0
OCC version: 7.5.3
Locale: French/France (fr_FR)
User avatar
dprojects
Posts: 721
Joined: Mon Mar 06, 2017 6:02 pm
Location: Poland
Contact:

Re: Texture mapping

Post by dprojects »

UbunTux wrote: Sat Apr 23, 2022 7:41 am Decor.zip
Here is the fixed version. I didn't keep your exact dimensions of the panorama but this show the correct approach to solve the problem. The default behavior of texture mapping is usually to apply the texture at the biggest surface. The main front surface need to be the biggest one. You can achieve the correct result by the simple bool cut operation, and apply the texture only at the CUT object.

Image
Attachments
DecorFixed.FCStd
(17.73 KiB) Downloaded 30 times

Thanks
Darek
github.com/dprojects

workbench for woodworking is available at: github.com/dprojects/Woodworking
UbunTux
Posts: 60
Joined: Fri Jan 25, 2019 12:11 pm

Re: Texture mapping

Post by UbunTux »

Thanks for taking the trouble to find a solution.
The constraint of applying the texture to the widest surface, requiring a greater height than necessary, can be easily circumvented by creating a cinemascope type panorama with 2 black bands.
Unfortunately, if the image flattens up to the rounding, it does not go all the way to the end of the wings of the U.
It's frustrating to feel so close to the goal.

Image
Image
Image

I tried to remove the facets from the front face using curves from the sketch and made a protusion with part. But no other result.
Image
Image
User avatar
dprojects
Posts: 721
Joined: Mon Mar 06, 2017 6:02 pm
Location: Poland
Contact:

Re: Texture mapping

Post by dprojects »

UbunTux wrote: Tue Apr 26, 2022 1:00 pm It's frustrating to feel so close to the goal.
If things start to be annoying, sometimes it is better to make one day break, or even more, if needed, to get deep breath and to look at things from different perspective.

Maybe you can try to shrink the edges of this picture in some graphics program? This will not be elegant solution but may work ;-)

Thanks
Darek
github.com/dprojects

workbench for woodworking is available at: github.com/dprojects/Woodworking
Post Reply