solarlune / tetra3d Goto Github PK
View Code? Open in Web Editor NEWTetra3D is a 3D hybrid software/hardware renderer made for games written in Go with Ebitengine.
License: MIT License
Tetra3D is a 3D hybrid software/hardware renderer made for games written in Go with Ebitengine.
License: MIT License
Repro is in this branch: https://github.com/eliasdaler/Tetra3d/tree/zorder_repro
Check animatedTextures example
When flying around, somewhere at this point you'll notice Z-fighting:
In my case, I can't place the objects apart from each other - Z-fighting like this happens when a player character gets near NPC characters and Z-fighting get pretty severe (and sometimes the Z-order is just wrong)
goroutine 1 [running, locked to thread]:
github.com/solarlune/tetra3d.LoadGLTFData({0xc00044c000, 0x1d81b, 0x1d81b}, 0x0)
/Users/xackery/Documents/code/go/pkg/mod/github.com/solarlune/[email protected]/gltf.go:162 +0x8e7a
exit status 2
seems:
newMat.TexturePath = doc.Images[*doc.Textures[texture.Index].Source].URI
is missing sanity checks and making assumptions, I'm using something similar to https://github.com/qmuntal/gltf/blob/80d3922a76d3e24371f8c99e0d213ecc8dae3ffe/modeler/example_test.go#L35 to generate a gltf and it is cutting corners on some steps, and causing tetra3d to panic non-gracefully
goroutine 1 [running, locked to thread]:
github.com/solarlune/tetra3d.LoadGLTFData({0xc0000cc000, 0x6c2, 0x6c3}, 0x0)
/Users/xackery/Documents/code/go/pkg/mod/github.com/solarlune/[email protected]/gltf.go:402 +0x82a7
this time I can attach the gltf it fails with:
interleaved.gltf.zip
This is based on https://github.com/qmuntal/gltf/tree/80d3922a76d3e24371f8c99e0d213ecc8dae3ffe#data-interleaving
Hello.
I have noticed that some objects in my scene are disappearing once I get close to them.
I thought that I could fix that by setting Near value lower, but unfortunately this didn't help.
See the modified scene from shapes example.
Left to Suzanne, there is an object which disappears if you get close to it.
You can also see it being clipped even if you don't get close but rotate camera around sometimes.
...and go mod
is unhappy with them. Currently it believe v0.5.2 is the most recent release because its the most recent one with "acceptable" semantic versioning per https://go.dev/doc/modules/version-numbers
To fix, re-release v0.8 as v0.8.0 or v0.8.1
Right now one has to io.ReadAll
before passing the data slice into LoadGLTFData
which wraps it in a reader, so why not pass a reader directly? Loading from file is not ideal, since assets may be embedded via //go:embed
into an embed.FS
(my case!), which also brings up a point of adding Load[DAE/GLTF]FromFS
.
Looking at LoadDAEData
, I assume it could also use a xml.NewDecoder
, but if there is some arcane reasoning behind umarshaling it three times separately from a byte slice, it could just io.ReadAll
to get it from the provided reader.
See repro here: https://github.com/eliasdaler/Tetra3d/tree/bounds_issues/examples/bounds
When trying to climb a new surface I added with a capsule, collision doesn't work properly and the capsule doesn't ascend.
I'm noticing a trend in this package:
func (part *MeshPart) AddTriangles(verts ...VertexInfo) {
mesh := part.Mesh
if part.TriangleEnd > -1 && part.TriangleEnd < mesh.triIndex {
panic("Error: Cannot add triangles to MeshPart non-contiguously (i.e. partA.AddTriangles(), partB.AddTriangles(), partA.AddTriangles() ).")
}
if len(verts) == 0 || len(verts)%3 > 0 {
panic("Error: MeshPart.AddTriangles() not given enough vertices to construct complete triangles (i.e. multiples of 3 vertices).")
}
Is there any reason sanity checks constitute an entire program failure? why not restructure to..
func (part *MeshPart) AddTriangles(verts ...VertexInfo) error {
mesh := part.Mesh
if part.TriangleEnd > -1 && part.TriangleEnd < mesh.triIndex {
return fmt.Errorf("cannot add triangles to MeshPart non-contiguously (i.e. partA.AddTriangles(), partB.AddTriangles(), partA.AddTriangles() ).")
}
if len(verts) == 0 || len(verts)%3 > 0 {
return fmt.Errorf("not enough vertices are provided to construct complete triangles (i.e. multiples of 3 vertices).")
}
There are 26 uses of panic in this package: https://github.com/SolarLune/Tetra3d/search?q=panic
And most aren't critical failures that require the entire application to exit immediately, most are simply malformed requests that can be reported back to abort current operation
Hello
Tetra3D's gltf loader crashes with this message:
panic: runtime error: index out of range [96] with length 96
goroutine 1 [running, locked to thread]:
github.com/solarlune/tetra3d.LoadGLTFData({0xa113e0, 0x76529, 0x76529}, 0xc000689f20)
<...>/Tetra3d/gltf.go:306 +0x4a45
I've added a part of my model to shapes.blend so that you can reproduce it (hopefully)
It can be found here: https://github.com/eliasdaler/Tetra3d/tree/gltf-crash/examples/shapes
Here's the part that causes the problem:
for triIndex, tri := range newMesh.Triangles {
tri.Normal = normals[triIndex] // <- here!
}
Adding a Print like this:
fmt.Println(len(normals), len(indices), len(newMesh.Triangles), mesh.Name)
shows this:
96 288 608 Cylinder.003
So, the number of triangles doesn't match number of indices...
Maybe I'm doing something wrong with Blender, so if there's something I need to do with my models, please let me know! :)
Hi I've tried running a few examples with the same results (see the attached).
I'm running Go 1.17 on Debian Stable (5.10.0-10-amd64) via Xorg. The GPU on my Thinkpad is an HD 520.
The video I've attached is of the animations example but the same thing happens on other examples. I've tried on the latest master branch and also checked out the v0.4.2 tag with the same results.
I know there isn't much you can do remotely for such a weird issue but figured I would still notify you. I'm a go developer myself and have built toy renderers before, but I'm kinda at a loss for how to debug this. If there is something I can do to help, let me know.
Install steps were just checkout
, go mod tidy
, go run ./examples/animation/main.go
.
Line 42 in c4f7bb6
The comment says that Get
returns nil
, but it definitely does not. It seems like this is the only way to set a property initially. So either the docs here are wrong, or its intended to set properties a different way?
I would have gone ahead and opened a PR to fix the doc, but I wasn't sure what the intention was.
[signal SIGSEGV: segmentation violation code=0x1 addr=0x20 pc=0x4431201]
goroutine 1 [running, locked to thread]:
github.com/solarlune/tetra3d.LoadGLTFData({0xc000ad8000, 0x1d71f, 0x1d71f}, 0x0)
/Users/xackery/Documents/code/go/pkg/mod/github.com/solarlune/[email protected]/gltf.go:158 +0xba1
github.com/xackery/quail/cmd.(*viewer).load(0xc0004e4bf0, {0xc000ad8000?, 0xc0002b3c68?, 0x1?})
seems
if texture := gltfMat.PBRMetallicRoughness.BaseColorTexture; texture != nil {
isn't happy with my hand crafted gltf files
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.