Hi @tomekkie2 I’m a long time happy user of your asset. Recently I ran in to an issues with the crosssection/surfaceshader/standard with vertex color on. When the light in the scene has a cookie, in my case cloud shadows from another asset, the shadows fail on the objects. They cast, but do not receive shadows. The minute I turn cookies off on the light they reappear. It is driving me nuts and it used to work and I made no changes to anything related to crossesction. In your shader wisdom, do you know what could be causing this? A unity settings, a missing fallback shader.
When I run it in the editor I can see the shader/material change just when I switch off the cookie (the geometry turns blue for a second) so something is changing, falling back etc. (sorry for my lack of shader knowledge). The shadows all work fine for crossection/standard.
Thank you very much in advance, Thomas
EDIT: Found out it started to happen when I moved to using materialPropertyBlocks for dynamic objects. I have no idea why that doesn’t work well with light cookies and shadows.
At least that was my solution in the two I looked at, double click the shader errors then compare them to the URP versions of the files to compare the differences.
Thanks for creating a wonderful asset that has provided me the best solution for the project that I’m working upon currently.
Needed your guidance with the functionality I’m describing below,
Pipeline: HDRP
My goal is to implement multiple cutting planes at user-defined angles.
These cuts will be created dynamically when the user draws a line on screen space using a Line Renderer and selects the section they wish to keep visible.
The other section will be hidden using your shader.
From the visible section, the user should be able to make additional cuts using the same input method.
Each time a new section is selected, the previously hidden portions should remain hidden, ensuring that only the newly defined section is visible.
I attempted to achieve this using your single_plane_hdrp demo scene but was unsuccessful.
Looking forward to your guidance.
Thanks
P.S. Thanks for the lightning fast support. You’re a wonderful person!!!
If you do not need the clipping functionality that would be relatively simple.
It would just be a matter of adding a new shader keywords for multiple planes and duplicating a shader code located inside section-clipping.hlsl used for multiple primitives or multiple tubes. The primitive or tubes data is stored inside an array and you would have to replace it with multiple planes data.
If you need also the capping functionality you should check if capping would work on the type of models that you are using.
If it is an animal or human model each type of tissue should be represented with non intersecting closed mesh with an appropriate material applied. In other words it should be 3D printable and it should pass STL check.
When using the capping functionality with multiple planes - additional passes for masking backfaces on the clipped parts of the model are also needed and that puts a limitation on number of planes.
If two capped section planes are enough for you, I would suggest using the setup pie section scene.
I bought the asset and I want to use it in a URP project in Unity 6. But in the middle of the demo scenes the objects appear with the usual purple material.
Can I fix this easily or do I have to wait for Unity 6 version?
Hi, I’m using the CrossSection asset in Unity URP. The texture appears correctly on the cut surface, but I can still see background objects through the cutting edge — it looks hollow.
I’ve recorded a video showing the issue. Please let me know how to share it or if you need more details.
Your gameobject contains intersecting meshes, so you should use other setup to apply the box section to it.
You should use setup from the box&intersection_urp scene. This setup is a bit more complicated, but allows for intersecting meshes.
The most common cases include intersecting meshes, so in the next update I am going to expose the demos them and hide the simpler, but less versatile demo scenes.
I have also purchased the crosssection 6 asset today and imported it in a new project. However i am also getting the same issue. Please find the screenshot.
Apologies for not checking it well enough in fresh Unity empty projects before uploading to AssetStore.
Thanks @Candid142, @EMaruTBR for letting me know about the issues.
This is a small unitypackage containing two scripts after correction, which should fix these issues.
[depreciated package removed] - for the time being, because I have also submitted the update to the AssetStore.
@tomekkie2 Is there still support for sphere capped objects in crossSection 6? The WebGL URP example works with the scene sphere_capped_urp. In the top left corner it says URP 17.3.
But I can’t find any example in crossSection 6. Furthermore, I don’t see any URP Render Pipeline Asset or Renderer for sphere capped as in crossSection 2.24.
Yes it is, of course.
But I got concerned the asset might seem oversized or overcomplicated, especially for a first time user, so I decided to limit the number of scenes included inside the base AssetStore package. I have added some new scenes, then grouped it into three folders:
elementary
essential
optional
The base AssetStore package contains only the essential folder.
I have moved the other folders to external downloads.
So the other scenes, including sphere_capped_urp scene, are there inside unitypackages, updated and consistent with the rest of the cross-section asset.
The encircled button opens download link for the additional scene packages:
Thanks @tomekkie2. I have the sphere section working correctly now.
Does the sphere section only support CrossSectionURP/Lit shaders? Whenever I set any other CrossSectionURP material like Simple Lit or Unlit on my test GameObject, the cutoff disappers.
Without _StencilMask, it doesn’t work and only CrossSectionURP/Lit has it. Also, all materials in the sphere_capped_urp are Lit.
Is there any way to get CrossSectionURP/Simple Lit working with sphere section?
This is a matter of crossSection keywords included inside shader code.
I have to limit the keyword numbers inside the asset, because it greatly affects the shader compilation time as well as the size of the build.
So I have selected the CrossSectionURP/Lit shader as the main demonstration shader and put the most of possible crossSection keywords in it, leaving only a few most common keywords in the rest of the shaders.
If you insist on using SimpleLit or Unlit shader in this example scene - you can just edit the #pragma multi_compile statements inside shader passes code inside CrossSectionURP/SimpleLit shader, adding the CLIP_SPHERE_OUT keyword used in this example.
Stencil settings on the material do not affect rendering in the game window in this scene with this Renderer used, but the material is used also in the other scenes, so these settings may matter somewhere else.
If you are working on games and the game characters get hidden inside environment or you are working on architectural presentation and important equipment is placed inside buildings - I have an idea for a solution to this.
Whether we call it as reveal shader, see-through shader or unhide shader in fact it is derived from multi-primitive clipping cross-section shader and I am going to add this feature to the cross-section asset.
Here are some screenshots and videos which are illustrating this idea.
Among the wide selection of common primitives my preference is the cone primitive, I think it is the best one for this purpose.
Possibly some variation of it, like solid angle or a rounded cone could also be an option.
I am open to any suggestions regarding this.
I have just made a great improvement by grouping the section clipping keywords into two sets, a shortened one and a full one.
The main keyword SECTION_ALL is defined as a static material feature and switches between the groups, while the keywords inside the groups are now branched dynamically.
This has greatly reduced the number of shader variants, shaders compilation times and build times.