Matching View To Projection - Projecting lines onto breps issue

Hi,
I am looking to project lines on to surfaces perpendicular to the camera. The issue I have come across is regarding the projection, the curve that is to be projected on to the surface raps around the entire brep? In reality, all I need is for it to project on to what the camera sees not everything it touches and the reset. I have looked in to lists and selecting the faces I want it to use, It worked but not too well, once there is more complicated geometry. Once the lines are projected is there a way of filling them in to change the colour? Any ideas?


Projection GHC.gh (16.0 KB)

You need to extract faces visible to camera

Projection GHC2.gh (21.6 KB)

If I correctly understood, You want to project your curve on to given Brep through the viewport Normal direction. If so, The viewport properties component may help you.
Furthermore if you don’t want the curve fully wrap over your Brep geometry, Try to deconstruct the brep and only select the target faces. Projection GHC_1.gh (26.1 KB)

Hi,
This is what I was trying to refer to when I mentioned lists. Yes, it does work, but only for very simple setups but what happens when you have complicated geometry, see image attached. This method would mean that you would manually have to select faces through lists and this seam somewhat conflicting as some faces in the list may not be relevant to that section.
Projection GHC2.gh (21.5 KB)

There is a command in Rhino SelVisible.
And projection can’t detect visible faces to camera automatically.

Hi Mahan,

Yes, that is part of the question. Thanks for that, I didn’t have the human plug in to start off with. I have now downloaded it, works well, thanks. The other question, this is what I was referring to when I mentioned lists. The issue is if there are multiple angles and therefore different faces, this process would become tedious and complex over a short period of time.

Projection GHC2.gh (21.5 KB)

Hi @seghierkhaled ,
Is there a workaround or is that just it, it cannot be done? You would have thought that this would have been easily possible in GH! :disappointed_relieved:

You have two solutions:
1 - define multiple projection vectors and extract all possible solution in a data tree format. In that case you don’t even need to use Human plugin.

2- set a button (Or even a timer which can automatically reset the vector) and update the camera projection vector as you turn the camera. It works well.

Try with idea of @mahanmotamedi1991 , you can get camera informations with python than intersect lines from camera locations and breps centers to extract faces where the curve must projected.
I am not sure if this work with various situations.

Projection GHC3.gh (23.4 KB)

1 Like

Hi @seghierkhaled ,
That’s great thanks! :star_struck: How can you make it select more than one face? At the moment it only selects one. :thinking:

i don’t understand what you mean?
it select the first face

At the moment the lines hit the first face, but if we look at it through the viewport it should realistically project on to multiple faces. Some columns are turned and therefore show 2 faces in relation to the selected viewport (refer to the third image), but only one of their face is reflected on. I have tried to alter the GH Code for it to select all faces visible in relation to the viewport but it does not work well.
Thanks!


Projection GHC3.gh (25.2 KB)

The lines intersect with the faces you see in the view.
If you want select some faces you need to do that manually. And if you have two faces , how Grasshopper know which one you need?

With the altered GH script I managed to get it to select multiple faces of one column in relation to the viewport, but it doesn’t work well.
Projection GHC3.gh (25.2 KB)

Hi @carlossonline, this topic has been discussed before, see if some of the solutions there are of interest to you:

Hi,
Thanks! This script still has the same issue; The projection revolves around the entire element and not just the faces it sees in regards to the viewport. Is there a way that GH only selects the faces it sees?


For box-like breps this can be simplified quite a bit by looking if the face normals match the projection direction by pi/2.

Projection GHC3.gh (31.9 KB)

Why you change this?
If you already choose faces you don’t need the script, and when you choose a view you need click update

1 Like

Try this
Create lines from the centers using negative vector of camera than choose the faces intersect with this lines

1 Like