You are right, if a brick is partially covered it will not give a nice result. But in general the view in the instructions shall be such that parts are not covered.
Of course i get something different that Lego does in the example above. That is a draft and a very simple approach. To avoid the interior lines, so you just want to have the outside, you need to find the edges, you can do this with a 2D algorithm, and delete all the color that lies within.
Now we are left with existing bricks covering the added bricks. We know the camera position and we know the position of the added bricks. We would need to find the bricks between camera and the added ones. now for a 2D approach to mask the highlighted line the renderer is given the "front" bricks. The resulting image is then added to the alpha layer of the highlight, i.e. where there was color before, there is now transparency.
So three layers might do the job.
a) Render of the CSI
b) Render of the Highlighted Edges
c) Render of the bricks Covering the Highlight
So the result would be a + (b - c)
The ideal result would be if you can tell this the renderer to do, i.e. show me only the visible lines of the parts in this step.
Mmmh: I might just have found another easy way to do it (needs some more proof but basically it worked), see below, LDView and LDConfig.ldr are my friends :-)
Starting image, completed CSI Image of the step (correct colors)
Now render the highlight:
It gets a bit more action here, but no problem
- Make the new parts, e.g. YELLOW
- Make the old old parts WHITE
- CHANGE LDconfig.ldr
-> set WHITE to #FFFFFF and the edge also to #FFFFFF
-> set YELLOW to #FFFFFF (this coudl be skipped as well) and the edge to bright yellow #FFFF00
- Render the Step as the step before, just aks LDView to use LDConfig.ldr and EdgesOnly=YES and EdgeThickness=5
-> We get a image of this highlights and white edges of the rest
(I should have used red to highlight...)
Add a bit of postprocessing:
- The resulting image need to have the color WHITE set to complete TRANSPACENY
- And merge it with the initial CSI
- don't forget to use the proper LDConfig.ldr again!
Still we have the studs, but progress as the hidden lines are no more there... :-)
Of course i get something different that Lego does in the example above. That is a draft and a very simple approach. To avoid the interior lines, so you just want to have the outside, you need to find the edges, you can do this with a 2D algorithm, and delete all the color that lies within.
Now we are left with existing bricks covering the added bricks. We know the camera position and we know the position of the added bricks. We would need to find the bricks between camera and the added ones. now for a 2D approach to mask the highlighted line the renderer is given the "front" bricks. The resulting image is then added to the alpha layer of the highlight, i.e. where there was color before, there is now transparency.
So three layers might do the job.
a) Render of the CSI
b) Render of the Highlighted Edges
c) Render of the bricks Covering the Highlight
So the result would be a + (b - c)
The ideal result would be if you can tell this the renderer to do, i.e. show me only the visible lines of the parts in this step.
Mmmh: I might just have found another easy way to do it (needs some more proof but basically it worked), see below, LDView and LDConfig.ldr are my friends :-)
Starting image, completed CSI Image of the step (correct colors)
Now render the highlight:
It gets a bit more action here, but no problem
- Make the new parts, e.g. YELLOW
- Make the old old parts WHITE
- CHANGE LDconfig.ldr
-> set WHITE to #FFFFFF and the edge also to #FFFFFF
-> set YELLOW to #FFFFFF (this coudl be skipped as well) and the edge to bright yellow #FFFF00
Code:
0 !COLOUR Yellow CODE 14 VALUE #FFFFFF EDGE #FFFF00
0 !COLOUR White CODE 15 VALUE #FFFFFF EDGE #FFFFFF
-> We get a image of this highlights and white edges of the rest
(I should have used red to highlight...)
Add a bit of postprocessing:
- The resulting image need to have the color WHITE set to complete TRANSPACENY
- And merge it with the initial CSI
- don't forget to use the proper LDConfig.ldr again!
Still we have the studs, but progress as the hidden lines are no more there... :-)