07-03-2020, 11:33 AM
Hi,
I am a very beginner with DXEngine (currently working with the trial version). In the past I have developed a WPF 3D application with big models (BIM models), and I face severe performance problems, especially when clipping the model (so far I implemented only clipping on a Z level in world space).
Now I have implemented my first shaders using DXEngine, and the performance is quite impressive. But I have a special issue with clipping (setting SV_CLIPDISTANCE in the vertex shader).
My simple trial model is a cube of 8000 spheres (20x20x20), each modeled as a WPF ModelVisual3D.
This is my model rendered in DXEngine using no effect (I assume a "default standard effect" is used):
Looks fine!
When I render it with my own shaders (which only change the colour), it looks like this:
This looks also fine and works very fast.
But when I clip the model (done also in my shader), it looks like this:
Clipping is basically correctly done. But the upper part (which should be clipped, i.e. invisible) seems to be rendered with the default standard effect.
For this sample I set the color of the WPFMaterial to completely opaque:
new DiffuseMaterial(new SolidColorBrush(Colors.Blue))
or
new DiffuseMaterial(new SolidColorBrush(Color.FromScRgb(1.0f, 0, 0, 1)))
But when I set the alpha value to a little bit lower than 1.0:
new DiffuseMaterial(new SolidColorBrush(Color.FromScRgb(0.99f, 0, 0, 1)))
clipping behaves now as expected:
What is the reason for this behaviour?
I am a very beginner with DXEngine (currently working with the trial version). In the past I have developed a WPF 3D application with big models (BIM models), and I face severe performance problems, especially when clipping the model (so far I implemented only clipping on a Z level in world space).
Now I have implemented my first shaders using DXEngine, and the performance is quite impressive. But I have a special issue with clipping (setting SV_CLIPDISTANCE in the vertex shader).
My simple trial model is a cube of 8000 spheres (20x20x20), each modeled as a WPF ModelVisual3D.
This is my model rendered in DXEngine using no effect (I assume a "default standard effect" is used):
Looks fine!
When I render it with my own shaders (which only change the colour), it looks like this:
This looks also fine and works very fast.
But when I clip the model (done also in my shader), it looks like this:
Clipping is basically correctly done. But the upper part (which should be clipped, i.e. invisible) seems to be rendered with the default standard effect.
For this sample I set the color of the WPFMaterial to completely opaque:
new DiffuseMaterial(new SolidColorBrush(Colors.Blue))
or
new DiffuseMaterial(new SolidColorBrush(Color.FromScRgb(1.0f, 0, 0, 1)))
But when I set the alpha value to a little bit lower than 1.0:
new DiffuseMaterial(new SolidColorBrush(Color.FromScRgb(0.99f, 0, 0, 1)))
clipping behaves now as expected:
What is the reason for this behaviour?