I'm interested in exploring the possibility of adjusting the camera perspective to simulate different angles in a 2D space. My goal is to achieve a more dynamic visual experience within the existing 2D rendering framework.
After some research and experimentation, I made modifications to the SetProjection in grid_renderer.go, Render method in buffer.go to update the projection matrix using the SetProjection method in the VertexBuffer. I adjusted the fovy (field of view angle) to try to simulate different camera angles.
In grid_renderer.go:
func perspectiveProjection(fovy, aspect, near, far float32) [16]float32 {
f := 1.0 / float32(math.Tan(float64(fovy/2.0)))
return [16]float32{
f / aspect, 0, 0, 0,
0, f, 0, 0,
0, 0, (far + near) / (near - far), -1,
0, 0, (2 * far * near) / (near - far), 0,
}
}
func (buffer *VertexBuffer) SetProjection(fovy, aspect, near, far float32) {
projection := perspectiveProjection(fovy, aspect, near, far)
loc := buffer.shader.UniformLocation("projection")
gl.UniformMatrix4fv(loc, 1, true, &projection[0])
}
in buffer.go
func (renderer *GridRenderer) Render() {
// ... (previous code)
// Calculate perspective parameters based on your requirements
fovy := float32(math.Pi / 4) // Field of view angle
aspect := float32(Editor.window.Size().X) / float32(Editor.window.Size().Y) // Aspect ratio
near := 0.1 // Near clipping plane
far := 100.0 // Far clipping plane
renderer.buffer.SetProjection(fovy, aspect, near, far)
// ... (remaining code)
}
Unfortunately, these changes seem to have no effect, I'm not entirely sure if this is the correct approach or if it's even feasible to adjust the camera perspective in a 2D rendering scenario. I wanted to reach out to the authors to seek your guidance and expertise on this matter.
Questions:
- Is it possible to adjust the camera perspective in a 2D rendering scenario using Neoray?
- If so, is the modification I made to the Render method an appropriate way to achieve this goal?
- Are there specific considerations or limitations I should be aware of when attempting to modify the camera perspective in a 2D space?
- Any insights or recommendations you can provide would be greatly appreciated. Thank you for your time and assistance!
I'm interested in exploring the possibility of adjusting the camera perspective to simulate different angles in a 2D space. My goal is to achieve a more dynamic visual experience within the existing 2D rendering framework.
After some research and experimentation, I made modifications to the
SetProjectioningrid_renderer.go,Rendermethod inbuffer.goto update the projection matrix using theSetProjectionmethod in theVertexBuffer. I adjusted the fovy (field of view angle) to try to simulate different camera angles.In
grid_renderer.go:in
buffer.goUnfortunately, these changes seem to have no effect, I'm not entirely sure if this is the correct approach or if it's even feasible to adjust the camera perspective in a 2D rendering scenario. I wanted to reach out to the authors to seek your guidance and expertise on this matter.
Questions: