External Styles

edited June 2023 in General

This commit for external styles/shaders is great!
One question, and maybe you can do this already and I just couldn't find it, but is the following process possible?
Let's say you open an ifc file in BlenderBIM, and you're working away adding materials and tweaking shaders as you 'design'. Is there a way, currently, to automatically save these shaders out to that external library?

Or is the indented workflow to have (2) blender sessions open at open time. One for the working file, and one for the materials library. That is, you tweak shaders in materials library session, and then 'update' them somehow in the working file session?


  • Currently it's intended to be used with two separate blender sessions - so there's no way to update external library shader or add new shader to the external library.

  • Couldn't the external library be the blender file that gets saved along with the IFC file?

  • Couldn't the external library be the blender file that gets saved along with the IFC file?

    But it is saved with the IFC file as a path to the external library.

  • I mean if the IFC file is project.ifc and the blender file that gets saved (that I usually ignore) is project.blend, the saved path to the external material library could be "./project.blend"

  • Currently it crashes if you try to append shader from the current .blend file but I think we can add support for that

  • Dumb question, how does one refresh the styles (from the library file) in the 'working file'?
    Do you have to close and reimport the ifc file?

  • @theoryshaw no, just reselect "External" style

  • Yup, I was pleasantly surprised how seamless the process was. However I think a dedicated button to reload the style would be more user-friendly in this case, would it not ? I'll plug the feature request I've written over on github for anyone interested in participating in the discussion. I suggest adding a button to reload all ifc styles, as there might be a lot in a single file.

  • Does anyone know if Is there a way at present to save the UV projection for the styles? I have my UV's set up in a way that bricks are the right scale etc, and that would be awesome to see in the reference, at the moment it comes in at a strange scale by default:

    As supposed to adjusting the UV's (for it to look correct:

    The UV scale isn't saved with the ifc and it doesn't seem to reference the blend scale well at the moment

  • edited July 2023

    IFC supports three types of texture mappings:

    1. UV (i.e. explicit coordinates)
    2. COORD (Blender calls this Generated)
    3. COORD-EYE (Blender calls this Camera - this is not very useful though)

    We can save UV data, but we can't load it since the C++ geometry iterator hasn't implemented it. We need to get @aothms on a train for this to happen :) Feel free to vote here: https://github.com/IfcOpenShell/IfcOpenShell/issues/2021

    As for COORD, in theory we can store a texture transformation (i.e. Blender's mapping node) but this is not yet implemented. See https://ifc43-docs.standards.buildingsmart.org/IFC/RELEASE/IFC4x3/HTML/lexical/IfcSurfaceTexture.htm however I have yet to do tests to see exactly what this means in the Blender world. For now, COORD works well for simple "plonk this rectangle image on this rectangle plane" which covers basic usecases like signage, decals, X-plane tree entourage, etc.

    However note that although the docs say the transformation affects the texture coordinates, I don't really think they do (I did quite a bit of work on the shader aspect of the IFC spec, and this is definitely un-battle-tested territory), since they are a 2D transformation. i.e. they cannot rotate say a 2D texture onto the Y axis of a brick wall. Also, we are restricted to using the "Generated" coordinate instead of "Object" or other things. This is because there is actually no standard on "magic texture coordinates" in the CG world. You know how Blender has "Flat / Box / Sphere / Tube" in the image texture node? That's Blender magic. Every 3D software has their own magic. The only thing you can trust is UV maps. I don't think it's possible to do what's in your screenshot because that relies on a rotation along the local X axis. See screenshot where we have a 90 degree rotation, which therefore breaks the image on a single plane. Also notice how the texture is squashed on short walls and stretched on longer walls - that is because the texture coordinates are Generated (i.e. 0 to 1 along the +Y axis). What you want for bricks is "Object" coordinates.

    Now we get more fun, because walls are actually not meshes. UV maps only kinda work easily / obviously on meshes. For parametric solids (such as walls which are typically extrusions) they have their own rules like this: https://ifc43-docs.standards.buildingsmart.org/IFC/RELEASE/IFC4x3/HTML/lexical/IfcExtrudedAreaSolid.htm#Figure- - which is just a ton of work to implement and needs to be done in C++ (and also then accommodate boolean clippings and curves and oh-so-much work).

    So I think the practical solution is to not use IFC glTF textures for this right now, and instead use external textures. Then you can use object coords / rotation mapping easily.

  • Is there any prospect of having a wall type with a 'brick' material, such that any walls created with this type render with correctly sized bricks?

  • Thanks for the breakdown @Moult !

  • @brunopostle yes, using external textures - the same way you'd have a generic brick material distributed as a material asset.

  • Sorry, could someone explain to me what this external textures means? And how/where to add to an object? Do you mean a .blend material that can be added with "Add external Style" under External Surface Style?

  • ktmktm
    edited November 2023

    Thank you, but sadly not. That way I also saw it in Yassines Tutorial, but somehow adding the external style does not do anything, even after hitting Update Current Style. Maybe connected to this is that I also don't see the "shading" style in Material Preview or Rendered mode. Whatever is set in the default Blender Material in the "Surface" tab just never seems to be overwritten by the IFC tabs... even tried different Blender Versions in case this was an issue with 4.0, but apparently not... likely I have some setting wrong, but which?
    Edit: Works in Blender 3.6.

  • i know bb isnt ready for 4.0 yet

    also, I've run into problems as well with refreshing extenal styles: https://github.com/IfcOpenShell/IfcOpenShell/issues/3848

Sign In or Register to comment.