3D scene occlusion
- Linguagem predominante
- Python
- Estrelas
- 93.9k
- Forks
- 7.7k
- Merge médio
- 2d 13h
- PRs com merge (30d)
- 4
Descrição
Is there a way to make 3D objects occlude each other?
For example, I made a surface and drawn normal vectors, but normal vectors have the same visibility regardless of whether they are behind something or not:

Here's the code I've written:
Basically I create a saddle surface and calculate normal vectors and add them to the ThreeDScene.
I tried changing the order of items, though didn't expect this would help and it didn't.
```py
class saddlepatch(ThreeDScene):
def saddle(self, x,y):
return np.array([x,y,x*y])
def vector_field_2D(self, func, boundaries):
field = np.array([func(np.array([x,y]))
for x in np.arange(boundaries["u_min"], boundaries["u_max"],.5)
for y in np.arange(boundaries["v_min"], boundaries["v_max"],.5)
])
return field
def construct(self):
TipableVMobject.position_tip = position_tip
self.move_camera(0.8*np.pi/2, -0.45*np.pi, 90)
boundaries = {
"u_min": -2, "u_max": 2,
"v_min": -2, "v_max": 2,
}
saddle_surface = ParametricSurface(self.saddle,
**boundaries, fill_opacity=0.5
)
self.add(saddle_surface)
def U(p):
x,y = p[0],p[1]
gradient_g = np.array([-y,-x,1])
return gradient_g/np.linalg.norm(gradient_g)
def U_at_p(u,p):
u = Vector(u)
UatP = u.shift(np.array([p[0], p[1], p[0]*p[1]]))
return UatP
normal_vector_field = self.vector_field_2D(lambda p: U(p)/2, boundaries)
p = self.vector_field_2D(lambda p: p, boundaries)
normal_vector_field_atP = [U_at_p(u,p) for u,p in zip(normal_vector_field,p)]
self.play(*[GrowArrow(vec) for vec in normal_vector_field_atP])
self.wait(2)
self.bring_to_front(saddle_surface)
self.begin_ambient_camera_rotation(rate=3)
self.wait(1)
```
Guia de contribuição
Nenhum guia de contribuição indexado para este repositório
Direção de pesquisa
A issue trata de oclusão em cenas 3D no manim. Dê uma olhada nas classes ParametricSurface e Vector no codebase e em como o ThreeDScene lida com ordem de renderização e profundidade. O código do usuário mostra que tentou usar bring_to_front. Investigue o pipeline de renderização e se o manim suporta depth testing ou z-ordering para objetos 3D. Verifique se há issues ou PRs existentes sobre renderização 3D e oclusão. O objetivo é encontrar uma maneira de tornar objetos atrás de outros não visíveis.
Escrita pelo modelo de indexação a partir do texto da issue.
Avaliação
- Domínio
- computer-graphics
- Tipo de issue
- Funcionalidade
- Dificuldade
- 4/5
- Tempo estimado
- 3-5 dias
- Status de atividade
- Estagnada
- Clareza
- Razoavelmente clara
- Facilidade para iniciantes
- 35/100