Jump to content

How to hide part of a object


photo

Recommended Posts

  • 1 year later...

We have had the same feature requirement.

We have created a shader, which has a clipping plane in world space and cut off objects, either above or below.

Fully adjustable, no need to split objects or use occluders.

(Needed it for a cable) oO

best

 

Edited by werner.poetzelberger
Link to comment
  • 7 months later...

@werner.poetzelbergerI was testing the cross section sample to achieve the same result, and it worked well.

But what I need it's a way to hide part of a specific object among many in the world.

Right now using the near clipping plane of the viewing frustum just cut every object in the world.

Did you achieved that, or was not part of what you needed? Anyone does have other experiences in achieving this task?

I have had achieved this effect a while ago in UE4 using masking

 

 

Btw testing occluders these are not solving the problem, since they hide the whole object or not.

Edited by davide445
Link to comment

I was researching on the topic and I have seen was asked a few times (as example here), but with no real solution.

I returned looking at my old UE4 project and here is the shader I created modifying the previous tutorial

image.thumb.png.09bbb00597da43783cc343a3453bda10.png

This is the generated HLSL code, want to ask if might be possible to port it in Unigine. 

 

LocationMaterial_box.hlsl

Edited by davide445
Link to comment

Hi Davide,

Not sure about converting directly the HLSL code, but it's definitely possible to write a custom shader that will cut all the meshes within a given radius.

Do you need to fill a cut with a specific color or it will be enough just to see the original geometry? It would be nice if you can show us how the final image should look like (feel free to use mesh from cross section sample) :)

Thanks!

How to submit a good bug report
---
FTP server for test scenes and user uploads:

Link to comment

Hi silent

this is the cross section sample, with just two of the elements enabled

image.png.5ea8f0d7b8ab58f59b363346003b5e83.png

- boolean_cube_cross_section_1 with his material cross_section_1 two sided, emissive, cross section

- cross_section_object_1_cross_section_1 with his material cross_section_2 without all these states enabled

I was expecting the second object was NOT cross sectioned, but he is.

The need it's not to enable the feature based on a radius (only) but based on the material assigned to the object.

Being material based I expect objects without the specific cross section state enabled will be not affected from the effect.

Also I find current example not working in term of extension, as you see in another test I made the cutting plane is not superimposed the second object, but the object it's sectioned anyway

image.png.fc834e84cc1a3b19724ea817d82e6c02.pngimage.png.97f073b4923ca71bf5eeb464c3b71361.png

The cherry will be to enable a volumetric effect with all deleted outside a primitive (i.e. a cube), so a boolean operation.

Edited by davide445
Link to comment

To sum up (please, correct me if I wrong):

  1. Cutting per object is most needed feature for now (even with only a single plane)?
  2. Adding cut by sphere is less needed feature and can be added later?
  3. Adding cut by various amount of planes is the last thing?

We can try to add more control to the current single cutting plane (so called "per object") mode, but it will work with mesh_base objects at the beginning. Other objects will be added later.

In theory cut by radius is also doable.

However, adding more cutting planes is the hardest part for the current implementation.

So, what do you think?

How to submit a good bug report
---
FTP server for test scenes and user uploads:

Link to comment

Sorry for the delay, noticed now I was not subscribed to this thread.

1. Yes absolutely. A single plane is fine.

2. Not needed by sphere, cut by cube is needed with lower priority. I see this an alternative respect multiplane (we never discussed about multiplane).

3. Not needed so far

If working with mesh_base objects mean working with any object using a mesh_base material it's fine, all my materials are mesh_base instances right now.

Link to comment

Hi Davide,

Thanks for the feedback, I've added all requests to the our internal bug tracker. We will not be able to include these improvements into the 2.10 release (all the devs are already fully loaded with current tasks), but as soon as we will have more spare time we will get back to this task.

How to submit a good bug report
---
FTP server for test scenes and user uploads:

Link to comment
×
×
  • Create New...