CrossSection

crossSection tool has got released on the AssetStore.

Here are the demos:

WEBGL asset scenes demo (standard render pipeline)
WEBGL asset scenes demo (universal render pipeline URP)
WEBGL demo examples (standard pipeline)
WEBGL demo examples (URP)
Standalone Windows HDRP demo
apk demo (builtin)
apk demo (URP)

Very simple to setup.
Works on shaders.
Works well on closed and not intersecting meshes as can be seen on the screenshots below and demos.
Intersectig meshes are also supported with retract backfaces shader feature or by set of dedicated stencil materials shaders.

The complex demos show the crossSection tool applied to some free models from the AssetStore.

4 step process to setup single plane section:
1491617--1094445--sections_2.gif


7882708--1002859--timber_section.gif

Contains a selective edge effect and supports post-processing effects.
1491617--796418--Untitled-20.gif

AssetStore link.

What are the advantages of your shader against this one?

There is a number of crossection shaders examples in this thread. The basic idea is exactly the same. But I’ve challenged myself with the idea of a crossection tool and I wanted a bit better and more versatile ones.
Means you won’t get this effect on these models with shaders from the thread. I actually use a set of substitute shaders for some selected Unity built-in shaders.

BTW. The links keep on working for me. Does anyone else find them broken?

Very nice idea!
I will be a future customer :slight_smile:

Keep up the good work!
Kenshin

PS: Demo links works fine for me

Thanks @kenshin.
I hope you would find that useful.
Possibly not as much in games as in architectural presentations or custom 3d object viewers.

A simple script for the horizontal floor crossections together with the demo scene was added today.

House model is nice, but I am not able to apply the crosssection effect … any hint? :slight_smile:

Not any more.
Try now.
Terribly sorry and great thanks for letting me know.
The scene is loaded dynamically and I just changed the script name, rebuilt the loading scene and forgot to rebuild the target scene, so it lost a reference to the script.

No problem man! :slight_smile:

Your script is very cool I have bought and I hope to use it soon in a real project.
Keep up the good work!

Bye
Kenshin

I have just reuploaded the package with more shaders, including Unity PBR Standard shader.
I have also added a gizmo for rotating the crosssection plane.
You can have a look at the new demo scenes from the here:
WebPlayer build:
http://virtualplayground.d2.pl/crossSection/cs.html
[WebGLbuild:
http://virtualplayground.d2.pl/crossSection/
(WebPlayer build fully works as intended, while WebGL not - regarding PBR shaders)

Some screenshots below:


](Unity Web Player | WebGL CrossSection Demo)

Would buy it if it was a Shaderforge-Shader that I could edit to fit my needs…

This is intended for making (faked) cross sections on complex GameObjects, using various materials with build-in Unity shaders - rather than a shaders collection.
I have never used the Shader Forge, but tried to find out on the web if it is possible to define clippling planes and backface passes with Shader Forge and haven’t found anything.

It took me awhile to get the hang of working with this, but it works really well.

I put together a quick demo that shows how to use it with prefabs (basically analyze the prefab materials up front, but apply the changes to an instance without wrecking the materials on other instances of the same prefab), and perhaps more importantly, how to quickly and easily use a GameObject to get the right position and angle of the desired clipping plane.

The demo isn’t interactive, but the code is fairly heavily commented and of course, if you can modify the location of the Marker object in the Prefab. Hope it helps. (And Tomasz, if you find it useful, please feel free to add it to your AssetStore package.)

2499010–172648–CrossSectionMarkerDemo.unitypackage (80.2 KB)

1 Like

You may be interested in this.

Thanks for your valuable contribution.
Together with other posts It makes me understand that i have overcomplicated the issue a bit by setting the SectionOffset parameter.
I guess it is messing the whole thing and I should just drop it, leaving just SectionPoint.
Then allow for moving the SectionPoint within the rendeners.bounds of the GameObject and rotating the plane normal aroud the SectionPiont with the move/rotate gizmo.
I would be going to change that at the nearest chance.

1 Like

Would a greater number of planes in the crosssection tool be useful?
Would there be a need for the pie section tool like that?

What do you think?

Now the second plane is included and the spherical clipping section as well if.


All should also work on mobiles (tested on Android), the Android .apk demo is here:

(moved from the other thread)

I just purchased your clipping asset to use the spherical clipping feature.

However, I can’t seem to get it working in a simple situation. I’ve tested the example scene and it works fine. But I can’t seem to rework the SphereSectionExample script to work for a standard clipping situation, with a game object being used to determine the clipping sphere’s position.

In other words, I’m trying to have the clipping sphere follow a gameobject, as you can do with the other clipping methods. But I can’t seem to get it working - at most I get the standard clipping even though I’m using the sphere script.

So how should I set up the sphere clipping to achieve this?

Thanks.

EDIT
Nevermind, turns out I just didn’t have the proper CrossSection shader applied (one with the sphere feature on it.) Thanks for the great asset! :slight_smile:
I do have one request: do you think you will add support for rectangle or square clipping bounds? Or would it be easy to add myself?
And I do have one more issue: it seems that, at least with the sphere shader, the clipped objects’ shadows are still visible. Is there a fix for this? I could screenshot the issue if needed.

I just had considered some features as experimental and didn’t include them in all of the shaders to limit the number of variants possible.
You could check the directives inside the shader; it could be something like:

#pragma multi_compile __ CLIP_PLANE CLIP_TWO_PLANES CLIP_SPHERE CLIP_CUBE
  • to include all of them actually.
    Clipped object shadows: - it is not possible to dynamically update the baked shadows in the baked shadows lighting mode; try the realtime shadows instead.
    The below is the sample of what I have got, when trying to add the cube clipping. Is that what you are after? It is a bit more complicated than sphere clipping because the orientation matters here (in sphere does not).
    2940120--217580--cube.jpg
    BTW I have just thought that cylinder clipping might also be interesting as you could make a “bulleting” effect using that; Unity has introduced new coding feature:
Shader.SetGlobalVectorArray

It could be used to set an array of clipping cylinders or spheres.

1 Like

Thanks for the in-depth reply!

I’ll try your suggestion out. I actually was using realtime shadows, however now that I think about it, it may actually be Unity’s new Ambient Occlusion camera effect that is shading the clipped object. I’ll test it out and get back to you.

As for the rectangular clipping, yes, that looks excellent, thank you! Cylinders would make a nice addition too, now that you mention it.

And on the arrays - yes, it would be fantastic to have multiple clipping ‘objects!’ That would definitely be a killer feature - being able to have multiple clipping objects would allow tons of interesting applications, like clipping a character’s mesh as a way of severing limbs, and etc…

I’ll be sure to leave a review on the asset page - thanks again for the amazing support. :slight_smile: