Nightly rendering problem

I have some custom components and the nightly builds rendering them incorrectly when raytracing is on. Here are examples of the same components with the stable and nightly versions. Any ide how to fix it?




KiCad can use wrl or step files to render the 3d view but best results are obtained with wrl as they contain colour info. If you have a step file installed alongside and named the same as the wrl model it will be chosen preferentially for export. If you activate them both in the 3d view though, you get the odd artefacts you’re re describing.

I don’t use both only the .step. It shows perfectly when editing footprint properties or raytracing is disabled while watching the complete board in 3D. The problem appears when I turn raytracing on to get a realistic view of the board.

1 Like

You should include the exact version of KiCad that you are using Help->About KiCad->Copy version info and the platform (win, mac, linux), if your nightly version is a couple of releases old, you should try to update and check if the error has been fixed in the meantime.

Sorry, forgot it! I’ve tried with several builds, getting the same result with all.

Here is the current one:
Application: KiCad PCB Editor (64-bit)

Version: (6.0.0-rc1-249-g84cfa052a1), release build

Libraries:
wxWidgets 3.1.5
libcurl/7.78.0-DEV Schannel zlib/1.2.11

Platform: Windows 10 (build 19044), 64-bit edition, 64 bit, Little endian, wxMSW

Build Info:
Date: Nov 30 2021 00:00:22
wxWidgets: 3.1.5 (wchar_t,wx containers)
Boost: 1.76.0
OCC: 7.5.0
Curl: 7.78.0-DEV
ngspice: 35
Compiler: Visual C++ 1929 without C++ ABI

Build settings:
KICAD_USE_OCC=ON
KICAD_SPICE=ON

KiCad uses OCC library for 3D models, the same engine is widely used, for example in FreeCAD. Usually that kind of effect happens when two surfaces are exactly in the same coordinates. The renderer has no way to decide which should be shown. This means that the problem is not in the rendering engine, it’s in the model. Maybe some certain renderer has accidentally shown this so that it looks correct, so the designer has thought it’s correct even though it’s ambiguous.

You can try the StepUp workbench in FreeCAD. It can import the STEP model and export it back to KiCad compatible STEP and WRL files. It often gives good results when a model isn’t compatible with KiCad.

1 Like

And this only applies to the nightly builds? Because in 5.1.12 I have no problem with these models

Could you share a custom model to check if I can reproduce the behaviour ?

I had a look in the “raytraced” versions of one of my PCB’s and all footprints render properly.

As der.ule mentioned, sharing (a few of?) the “faulty” 3D models may help with diagnosing / fixing.

Even if the models themselves are faulty, if it’s reasonably easy to build some tolerances into KiCad to render such models as a user would expect, this may be a good idea.

We still don’t know where the problem is, but it’s possible it can’t be fixed in KiCad, or even in OCC with “tolerances”.

Let’s suppose we have to dots or circles in a 2D plane with different colors. Both are in the same coordinates. Only one color should be shown, not a mixed color or something like that. Which dot you will choose and why? This is the problem I described. If two surfaces are in the same place in a 3D model it’s impossible to tell which one should be shown, and it depends on the implementation what it does. In this case the outcome looks like it happens by some internal order and reveals internal workings of the engine in form of triangulation.

It’s possible that some engine deterministically takes only one surface using e.g. the order of appearance in the file. But if that’s not defined in the file format standard it’s as good as random.

If this really is the problem, the only solution is to fix the 3D model so that one object or surface is in a slightly different coordinates than the other, for example the outer surface is 0.0001 mm outside of the other object. If you want to draw text in a STEP file you can’t have the object surface in e.g. horizontal zero plane and the text surface in the same plane. The text must protrude some amount along the z axis so that the upper surface of the text is above the object surface.

If two surfaces are interfering, maybe they can be distinguished if one has a “default grey” color, and the other has multiple colors, or textures. It might work to suppress the “grey” surface.

Yes, exactly the same behaviour!

paulvdh: attached one for testing

Aluminum_electrolytic_capacitor_radial_D10_H20_PinD0.6_Pitch5_nominal_brown.step (269.6 KB)

thanks @zsolesz79, this is how it looks with my relatively old v6.0-RC1:

Footprint properties:

3D viewer, normal:

3D viewer with raytracing:

FreeCAD:

What I noticed in FreeCAD is that the model is made of some bodies with a metal can with another body on top of it for the color and another one for the white line, if I select all the bodies and create a compound or export only the metal can, it looks like this now:

EDIT: Forgot version info

Application: KiCad PCB Editor (64-bit)

Version: (6.0.0-rc1-57-gf03efa1cba), release build

Libraries:
	wxWidgets 3.1.5
	libcurl/7.78.0-DEV Schannel zlib/1.2.11

Platform: Windows 10 (build 18362), 64-bit edition, 64 bit, Little endian, wxMSW

Build Info:
	Date: Nov 18 2021 12:01:02
	wxWidgets: 3.1.5 (wchar_t,wx containers)
	Boost: 1.76.0
	OCC: 7.5.0
	Curl: 7.78.0-DEV
	ngspice: 35
	Compiler: Visual C++ 1929 without C++ ABI

Build settings:
	KICAD_USE_OCC=ON
	KICAD_SPICE=ON
1 Like

if you make a single object (make a union (fusion) of the object and export it as a single obj, the 3d rendering is fine


here the FC file for reference
capacitor-Fusion001_simple_copy.FCStd (51.0 KB)

3 Likes

Same here, but also see a potential fix here — in a nutshell: re-saving the STEP 3d model in FreeCad.

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.