zesage / flutter_cube

A Flutter 3D widget that renders Wavefront's object files.
Apache License 2.0
267 stars 91 forks source link

Faces flicker on a custom mesh #30

Open azimuthdeveloper opened 3 years ago

azimuthdeveloper commented 3 years ago

Hey,

This package is great, I've noticed an issue where certain faces will flicker in and out of existence when the user rotates around the object.

flickering_faces

When I import a wavefront file from the web, it works fine, so it's almost definitely something I'm doing in the export process. My .obj file has two objects in it, could this be the source of the problem? I've also triangulated faces etc to no avail.

ghost commented 3 years ago

I am not familiar with this package but I know that this is a camera issue, try to change the camera near value if there is an option

azimuthdeveloper commented 3 years ago

I've played around with camera.near just now and it hasn't made a difference :( but I don't know what a suitable value for this would be.

Flucadetena commented 3 years ago

I've played around with camera.near just now and it hasn't made a difference :( but I don't know what a suitable value for this would be.

I'm facing the same issue. If you find a solution please Let me know. If I do I'll tag you on it.

From my test, I don't get this flickering/artifacts when the "estructure" is thick, but with thin planes it always does it.

Flucadetena commented 3 years ago

I've nail down the error to what it seems to be a problem of how the obj is being process. Apparently if you put too object to close together and one has multiple polygons, even worse if it is thin, it will create does artifacts.

I'm trying to find a way of not getting them by modifying the design. But it is difficult and tedious.

It would be nice to get a solution, this is the best .obj loader I could find!

Thanks, if I can help in any way please let me know.

azimuthdeveloper commented 3 years ago

It's almost like it's conditionally rendering the polygons depending on a certain condition. But toggling backface culling doesn't make a difference. I think someone (maybe even me haha) is going to have to try to open this thing up and comment out the bit of the code that does that.

Flucadetena commented 3 years ago

It's almost like it's conditionally rendering the polygons depending on a certain condition. But toggling backface culling doesn't make a difference. I think someone (maybe even me haha) is going to have to try to open this thing up and comment out the bit of the code that does that.

I've been avoiding going in the code myself, I have wayyy to much work and can't lose time on that. But I think it is going to be the only way.

If you make any improvement or fork to try and fix the code, please tag me here so I can help.

;)

azimuthdeveloper commented 3 years ago

It's almost like it's conditionally rendering the polygons depending on a certain condition. But toggling backface culling doesn't make a difference. I think someone (maybe even me haha) is going to have to try to open this thing up and comment out the bit of the code that does that.

I've been avoiding going in the code myself, I have wayyy to much work and can't lose time on that. But I think it is going to be the only way.

If you make any improvement or fork to try and fix the code, please tag me here so I can help.

;)

I'll have a run at it and let you know how I go. Spoiler alert: I have no idea what I am doing.

Flucadetena commented 3 years ago

It's almost like it's conditionally rendering the polygons depending on a certain condition. But toggling backface culling doesn't make a difference. I think someone (maybe even me haha) is going to have to try to open this thing up and comment out the bit of the code that does that.

I've been avoiding going in the code myself, I have wayyy to much work and can't lose time on that. But I think it is going to be the only way. If you make any improvement or fork to try and fix the code, please tag me here so I can help. ;)

I'll have a run at it and let you know how I go. Spoiler alert: I have no idea what I am doing.

hahahhaa, thats two of us! I hope you find the solution and save us both!. Tag me on the fork and I'll help you this weekend, as I need to fix this asap ;)

Flucadetena commented 3 years ago

Hey @lewcianci any luck??!!