Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

289
Visualizações
Raycasting mouse position to draw on 3D mesh

I want to draw on a 3D object, and the way I do it is to raycast hits from the mouse position and paint the closest 3D vertex to that hit.

However, when I am moving the mouse really fast, the hits are not registering, and there are big gaps in my drawing:

Missing drawing

What could be the issue?

over 4 years ago · Santiago Trujillo
1 Respostas
Responde à pergunta

0

The issue is pretty clearly that you are not sampling inputs quickly enough for your given painting strategy. This may be because the time between samples is unusually slow (perhaps because your raycasts are taking too much time) or because the speed of the mouse simply exceeds any reasonable sampling rate. This is a fundamental flaw in your painting strategy, which is to paint one vertex for each input sample.

A more robust approach would involve some sort of interpolation. Here are two approaches that come to mind:

  1. Interpolate the input samples. I.e., if one mouse input is sampled at coordinates (x1, y1) and the next input is sampled at (x2, y2), you could add imaginary samples along the line segment from (x1, y1) to (x2, y2) and raycast those as well. If your raycasts are costly, this may not be a performant option. Also you would have to somehow determine a good number of extra points to introduce.
  2. Interpolate along the mesh. In this case, you raycast two consecutive input samples to find two corresponding vertices on the mesh. Then you also paint all vertices along a path between those two vertices. The shortest path seems reasonable, but perhaps there are better strategies for your case.
over 4 years ago · Santiago Trujillo Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda