Getting the color at the end of a line

Hi all!

If I have 2 points in 3d space, is it possible to get the color of one end of that line that goes through them?

Maybe I should use a single pixel camera that looks down the line?

Is there another way?

Is this really unclear?

so many questions!


can you elaborate a little
what color are you talking only color avaialbe might be vert color !

is it a mesh line or curve ?

what is your goal overall ?

happy bl

Yeah, I could be clearer.

I have 2 points in space. One is the point I’m at, which makes the other the direction I’m looking at. It might not be the best way but for me to solve this i imagine a line that runs through these points. this line will, intersect with an object in my 3d scene at some point. I would like to know the color of the spot that it runs into the object at.

Maybe imagine it as a single pixel camera?

Sorry, I really am trying to explain this as best as i can.

You can ray_cast the scene to find an intersection:

Note that the ray won’t hit verts and edges, only faces. Use the object and location of the ray_cast result and calculate the color at that point (UV?).

is there much more examples showing some graphic for the different vectors and
how this is working !


Thanks CoDEmanX! I looked at ray_cast but only know that I get the object. I’m wondering how I would go about “calculate the color at that point” like you mention. Would I be able to take into account the rest of the scene (lights and shadows) for this point?

certainly not lights and shadows, unless you render the scene and obtain the pixel at the right location.

Color based on e.g. vertex color or uv texture would require some coding, you basically need to tessellate and interpolate.