Announcement

Collapse
No announcement yet.

Blender to Open Rails Exporter Transparency

Collapse
X
Collapse
First Prev Next Last
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Blender to Open Rails Exporter Transparency

    Hi all!

    I've basically finished my TrainSimulations SD40 enhancement project and have a 3d model that is fully functioning in game. Now I'm working on the finer details and this is where I could use some help.

    The most immediate problem I am having is with transparent surfaces such as windows and grills. As seen in the attached photos, they are coming out fully opaque, as expected with the 'MSTS Material' settings being 'Solid Opaque'.

    When I try changing the material to another setting, such as 'Alpha Blended' or 'Transparency On/Off', I get the error seen in the attached image below which reads as "AttrubuteError: 'NoneType' object has no attribute 'source'".

    I am not sure how to rectify this.

    The other issue I am experiencing is that my model appears darker than its default contemporary, both in game and in the TRSE consist editor. I am not sure how to address this.

    As always, any help is appreciated. Thanks!
    Attached Files

    #2
    The 'BaseColorFilePath' field in the MSTS Materials section should be pointing to the texture file. The one in your screenshot is blank.

    Comment


      #3
      Perfect! That solved the issue with transparency and exporting. Now I am facing a tricky situation. For the shading problem, I played around with the "Lighting" setting of the "MSTS Materials" portion of the exporter and basically got the brightness of both models to match.

      When using the setting 'Specular 25', I would in theory get the desired results with brightened surfaces on the lit side, with darker surfaces on the shaded side. Now unfortunately, the opposite happens and I have a theory as to why.

      When exporting to open rails, if normals not inverted in Blender, the model appears inside out in Open Rails. Now when the normals are oriented normally in Blender, they produce the intended lighting effect, but are inside out in Open Rails. I'm unsure how to address this.

      Attached below are screenshots showing the issue. The first three show the model in Open Rails and in Blender with inverted normals in Blender, and appearing normal in Open Rails. The last two show the model with properly oriented normals on the long hood in Blender, appearing inverted in game but with proper shading.
      Attached Files

      Comment


        #4
        Is this a whole new model from scratch?
        -Shawn K-
        Derby Rail Shops
        Maine Central Mountain Division: 20% Track, 10% Scenery.

        Comment


          #5
          Originally posted by CSRX View Post
          Is this a whole new model from scratch?
          In this case, I'm working on TrainSimulations' CN SD40 as a base, and I'm using this to teach myself some basics of Blender for future projects.

          Comment


            #6
            When modelling I leave the Transparency shader in MSTS materials on Solid Opaque. I find if it is set to any of the other settings I get weird transparency effects and missing geometry depending on the angle of the camera as shown in the image below. I only change the Transparency shader to Alpha Blended when exporting.

            Click image for larger version

Name:	so_vs_ab.jpg
Views:	628
Size:	47.1 KB
ID:	2302257


            What I normally do to quickly check back facing normals is tick the Face Orientation checkbox in the ViewPort overlays. This shows back facing normals in red and camera facing normals in blue. Note that if you have Backface Culling checked in View Port Shading then the red will/may not display but show as transparent in some Viewport shading views.

            Click image for larger version

Name:	faceOrientation.jpg
Views:	149
Size:	50.4 KB
ID:	2302258


            Another option to view normal direction is selecting Normals in View Port overlay. These are only an option in Edit Mode. You can increase or decrease the length of the normal indicators as desired by typing a value or left mouse button dragging in the Size field.

            Click image for larger version

Name:	normals.jpg
Views:	149
Size:	54.5 KB
ID:	2302259



            Comment


              #7
              So I figured out the root of my shading problem. For some reason when I export from Blender to .s, the inside faces get displayed on the outside of the model in Open Rails. As of now, my remedy for this has been to flip all faces so that the inside of the plane faces outward, however in Open Rails, this means the face that is not being lit by the sun faces outward and produces an effect where the faces being shaded appear lit, and the lit faces appear to be shaded.

              If I can make it such that properly oriented normals face outward in Open Rails, the model will be lit properly, but I'm still working to find a way to address this.

              Attached below are visualisations of the issue with the model in Blender, and the resulting output in Open Rails.
              Attached Files

              Comment


                #8
                Use CTRL + A and apply the scale transform.

                If you export the default box does that export OK? Does Shape File Viewer display the model correctly?

                If that does not resolve it then I'm at a loss to explain why you are getting the opposite result from what is expected.

                Comment


                  #9
                  This problem has been solved. It's just a matter of mirroring faces, and meshes as necessary to have the proper side facing outward.

                  Now the model is basically ready, but there is one final problem I have encountered. The animations of the bogies and wheels are backwards. This takes the form of the bogies pivoting in the opposite direction of curves, and wheels rolling opposite to the direction of travel.

                  I am endeavouring to find a solution to the problem, but I have been unsuccessful so far. Are there any resources relating to locomotive model animations in blender?

                  Comment


                    #10
                    It feels like you have a scale setting of -1 somewhere in that model object or one of its parent nodes. This would cause the inverted faces, and inverted animation. It may have been introduced when you imported the model. See post #8 to remove the scale factor. Then you will have to re-invert the faces.

                    Wayne

                    Comment


                      #11
                      Pete has pdf documentation on rolling stock, scenery and 3D cab view creation with Blender on his github site.

                      Open Rails Blender Content Creation Notebook. Contribute to pwillard/ebook-ORTSBCCN development by creating an account on GitHub.


                      If you don't have negative scaling on your model, enable the 'move' gizmo so you can see how the objects origin point is oriented.

                      In the screen shot below the gizmo at the origin point for the wheel on the right is showing the Y direction oriented in the correct +Y direction. For demonstration purposes, the wheel on the left has been rotated 180 degrees in the Z axis in object mode and you can see the Y axis for that wheel is pointing in the wrong -Y direction. This will cause that wheel to rotate in the reverse of the expected direction in the game engine.

                      Click image for larger version

Name:	origin_points.jpg
Views:	349
Size:	44.3 KB
ID:	2302531


                      To resolve, you could rotate the object 180 degrees in the Z axis.

                      However if the geometry is oriented correctly but the origin point is not, then go to the Tool tab and in Options>Transform>Affect Only, check Origins check box.

                      With just the problem shape selected use 'R' + 'Z' + '180' and you will see the gizmo at the origin point rotate 180 degrees but the object geometry will remain in place.

                      Don't forget to un-check the Origins check box, otherwise you inadvertently change the origins for other objects that you did not intend to do.

                      Comment

                      Working...
                      X