Being optimized for ArchViz it has two section planes, a horizontal and a vertical one.
The shader recieves position and y-rotation using global values from a runtime-helper-transform-gizmo which is included in the attached Unitypackage.
It is far away from being perfect but may be a good starting point for your improvements:
You are invited to use the package for free and share your improvements here.
Maybe someone knows how to access the backfaces and make them red?
Looking forward,
Carsten
PS: Please make your improvements in Shaderforge, so that users can simply customize it to their needs without writing any shadercode.
I have accessed the backfaces.
To get that I turned your shader backfaces off.
Then made a simple backfaces shader and applied it to GameObject’s duplicates.
See the result here:
I think it would be more logical to set/enable a shader keyword instead of a float like “_OpacityOverride” to manage the clipping on/off.
I made this backfaces shader outside SF, but I guess it should be possible to make a similar one in SF or even add the backface in the crossSection shader.
I am just wondering if there are any practical reasons for setting another clipping plane just perpendicular to the first one instead of paralell or inclined at arbitrary angle.
Is there a need for more planes, like a third one perpendicular to the first two?
I also like the gizmo, athough there are errors with moving it along axis. It actually moves on clicking the axis, especially when clicking from directions close to paralell. I guess the raycast hit.point should be cast on the axis in order to eliminate that.
Thanks, that´s a way to do it, but doublicating geometry is not my favorite way.
In architecture presentations we usually have only two sections, horizontal and vertical.
But defining a sectionplane by a direction (a faces normal, Vector3) would also be a great.
But unfortunately I wasn´t able to make it in SF.
Feel free to improve and upload the Gizmo.cs script
Common 2d cad-drawings are based on a single section, vertical OR horizotal…
Well, having a cross section tool for realtime architecture presentations offers new possibilities and there are no rules.
So I thought having the two sectionplanes active at the same time is cool and reasonable.
This would be the way to go, but my nodetree in SF is a bit hacky and until now I don´t know how it could be done.
Maybe the whole node structure should be reconsidered.
Agree, the project now looks cool with 2 perpendicular planes and y rotation, don’t you fear it would get a bit weird if we added the second rotation axis? Not too much and too complicated for an average user?
I guess that could be a key issue for the further development of this open source SF-cross-section project. Possibly someone will know and will help us.
I understand. However, unfortunately I know nothing about shaders, nor shadowforge, so I won’t be able to do this on my own. I just had an idea, how I could use it and hoped that maybe it will be ok as it is. Thanks for reply.
Hello. I’ve make a system like yours for an app of Embryo Visualization in 3D, but i want to make that hidden part of the gameObject not clickable. Do you think this possible?
That’s relatively easy to achieve, but with the section area not clickable, either. I could post a simple script for that, if still interested.
To make clipped volume not clickable - just cast a ray and check the hit.point the same way like is is being done in shader and that’s all.
I would use a more generic plane notation that can handle any plane position and rotation. Pretty much the same as unity uses internally in the Plane class. (Normal and distance from the origin.) It might look a bit more complicated at first, but it can be implemented very elegantly (and fast) in a shader. And it still needs just 4 floating point values.
There are various ways to initialize the Plane object base on a transform, but this is one:
new Plane (transform.rotation * Vector3.up, transform.position); // No rotation has the plane facing up
Then you transfer the information to the shader like this:
new Vector4 (plane.normal, plane.distance); // This probably only works with my own Vector4 version...
new Vector4 (plane.normal.x, plane.normal.y, plane.normal.z, plane.distance); // This should work by default
Then to detect whether you are clipped by the plane in the shader:
if (dot (pos_world, plane.xyz) > plane.w) // Elegant
{
}
An extra feature is that you can easily apply shading to the clipped part by just reusing the plane normal:
// Inside the clip detection if
normal_world = plane.xyz;
// Apply shading or just output the new normal