Texturing Architectural Objects

A forum dedicated to the Draft, Arch and BIM workbenches development.
Forum rules
Be nice to others! Respect the FreeCAD code of conduct!
paullee
Veteran
Posts: 5118
Joined: Wed May 04, 2016 3:58 pm

Re: Texturing Architectural Objects

Post by paullee »

furti wrote: Sun Oct 21, 2018 5:14 pm I only tested with 0.18 and python 3 right now. Got the same error like you with python 2. Maybe you can try a python 3 build too?
OK, tested with this one I already downloaded sometime ago
- FreeCAD_0.18.14859_Conda_Py3Qt5_glibc2.12-x86_64.AppImage

And it is great, it works! Thanks! Great Feature I can't wait to test!

Feature Request :)
  1. Though in View-Draw Style - Shaded Mode: The texture does not show shading whilst the remaining model w/o texture is shaded
  2. Possible to add shadow - somehow off topic? - I remember Yorik had experimented that
  3. Possible to incorporate into WPProxy?
  4. A central on-line database of textures?
Thanks again.
Screenshot from 2018-10-23 06-55-03.png
Screenshot from 2018-10-23 06-55-03.png (336.93 KiB) Viewed 2156 times
User avatar
yorik
Founder
Posts: 13659
Joined: Tue Feb 17, 2009 9:16 pm
Location: Brussels
Contact:

Re: Texturing Architectural Objects

Post by yorik »

The ideal would be a proper, FreeCAD-wide, new "Textured" display mode. But this represents a serious amount of work. Not that much to display textures (everything is there in Coin already), but to allow the user to define mapping correctly. It makes little sense to enable the display of textures if you can't define the size and positioning of it.

Maybe we can start a discussion here about how to implement that in a simple and easy way

In any case this could be started in Arch, and extended to whole FreeCAD after it is tested and works well.
User avatar
furti
Posts: 344
Joined: Mon Nov 27, 2017 5:27 pm

Re: Texturing Architectural Objects

Post by furti »

A proper display mode will of course be the optimum. :)

But to implement this might not ne easy. For arch stuff it works pretty well to simply map the texture to each face separately. But when one wants to texture a arbitrary part or mesh it will quickly come to uv unwrapping and there are tools out there that can do thia pretty well. Don't know if it worth to implement such things in freecad :?:
yorik wrote: Tue Oct 23, 2018 2:23 pm In any case this could be started in Arch, and extended to whole FreeCAD after it is tested and works well.
I think it might be best to start all this with a separate workbench. So we can play around and check what might work and what not, without messing with FreeCAD core. And when we know what usecases we want to support, we can start migrating the code to the core.

I think the general concept of the workbench might work pretty well.
- users can configure textures and they are stored in the document.
- maybe we can support multiple texture configs at once
- users can choose to display textures ir not
- textures are displayed in real world scale
User avatar
bernd
Veteran
Posts: 12851
Joined: Sun Sep 08, 2013 8:07 pm
Location: Zürich, Switzerland
Contact:

Re: Texturing Architectural Objects

Post by bernd »

yorik wrote: Tue Oct 23, 2018 2:23 pm ... It makes little sense to enable the display of textures if you can't define the size and positioning of it.
That is why I have given up years ago ... See https://forum.freecadweb.org/viewtopic.php?t=7216 It is easy to start but as soon as one would like to have a real scalling and the direction turned the right way it gets difficault. masonry texture is a very good example to play with.


yorik wrote: Tue Oct 23, 2018 2:23 pm Maybe we can start a discussion here about how to implement that in a simple and easy way

In any case this could be started in Arch, and extended to whole FreeCAD after it is tested and works well.
would be cool
User avatar
furti
Posts: 344
Joined: Mon Nov 27, 2017 5:27 pm

Re: Texturing Architectural Objects

Post by furti »

bernd wrote: Tue Oct 23, 2018 5:22 pm as soon as one would like to have a real scalling
This was the first thing i played around with. And I am pretty pleased with the result. Next thing I want to try is to let the user set a Rotation for the texture per face.

Scaling a texture is done by changing the length and hight property in the texture config. This is the same texture on the same object at the same camera position with different size settings:

Approximately the size the bricks should have in real life:
bricks_realsize_settings.png
bricks_realsize_settings.png (1.67 KiB) Viewed 2114 times
bricks_realsize.png
bricks_realsize.png (432.34 KiB) Viewed 2114 times
Scaled to be twice as big as in real life:
bricks_doublesize_settings.png
bricks_doublesize_settings.png (1.8 KiB) Viewed 2114 times
bricks_doublesize.png
bricks_doublesize.png (435.79 KiB) Viewed 2114 times
Maybe you can try the workbench and give me Feedback if it is what you expected.
User avatar
yorik
Founder
Posts: 13659
Joined: Tue Feb 17, 2009 9:16 pm
Location: Brussels
Contact:

Re: Texturing Architectural Objects

Post by yorik »

I think we could start with what SketchUp does, it's rather simple: It just allows to set a texture image path, a length and a width:
Image

The main Coin object to use is the SoTexture2: https://grey.colorado.edu/coin3d/classSoTexture2.html If no specific mapping is specified (Coin has also more complex UV mapping tools), each geometry type (cubes, faces, etc) have their own predefined mapping coordinates. So we could basically just start by add 3 new properties (image path, length, width) and add an edit dialog somewhere.

In Draft I also already experimented with what is needed to add texture and scaling to a node, it's actually not hard, it basically works like this (theorical case just to illustrate):

texture = coin.SoTexture2()
texture.filename = "/path/to/some/image.jpg"
texcoords = coin.SoTextureCoordinatePlane()
texcoords.directionS.setValue(length,0,0)
texcoords.directionT.setValue(0,height,0)
separator.addChild(texture)
separator.addChild(texcoords)

I think this would be a good start...
User avatar
furti
Posts: 344
Joined: Mon Nov 27, 2017 5:27 pm

Re: Texturing Architectural Objects

Post by furti »

yorik wrote: Wed Oct 24, 2018 3:17 pm It just allows to set a texture image path, a length and a width
This is exactly what is possible with the workbench now.

I used the textureCoordinatePlane approach early on, but came to a dead end real quickly. Maybe i tried not hard enough. But this approach led to textures mapped to one face as it should but other faces where not mapped corrrectly. And it will prevent users from adding a texture to a single face or only rotate the texture on a single face and keep other faces at the Default rotation.
paullee
Veteran
Posts: 5118
Joined: Wed May 04, 2016 3:58 pm

Re: Texturing Architectural Objects

Post by paullee »

Not sure if we need texture setting with UV mapping - mapping the lawn as in Furti's example is already very useful.

Otherwise if some UV mapping setting that could be 'exported' and shared with Blender e.g., it may be worthwhile to save the double-handling (FreeCAD - Blender integration?)

BTW, is it possible to show FlatLine for the Faces with texture mapped - currently, lines on edges are no longer shown.

Thanks.
User avatar
furti
Posts: 344
Joined: Mon Nov 27, 2017 5:27 pm

Re: Texturing Architectural Objects

Post by furti »

paullee wrote: Wed Oct 24, 2018 4:42 pm BTW, is it possible to show FlatLine for the Faces with texture mapped - currently, lines on edges are no longer shown
Yea this should be pretty easy to fix. It was easier to set the texture model to "Replace". But this seems to override the lines. :)
Maybe you can create a issue in the github repository in the meanwhile?
paullee
Veteran
Posts: 5118
Joined: Wed May 04, 2016 3:58 pm

Re: Texturing Architectural Objects

Post by paullee »

furti wrote: Wed Oct 24, 2018 6:27 pm
paullee wrote: Wed Oct 24, 2018 4:42 pm BTW, is it possible to show FlatLine for the Faces with texture mapped - currently, lines on edges are no longer shown
Yea this should be pretty easy to fix. It was easier to set the texture model to "Replace". But this seems to override the lines. :)
Maybe you can create a issue in the github repository in the meanwhile?
Done
Post Reply