Comments (15)
You need to update to Asymtpote 2.39. We don't support old versions.
from asymptote.
Sorry for reporting this problem with an old version of Asymptote.
Unfortunately, the issue persists in newer versions.
I have compiled Asymptote 2.40git from source, and the example now results in a segmentation fault:
$ cd asymptote-2.40git/
$ wget http://hboehm.info/gc/gc_source/gc-7.4.2.tar.gz
$ wget http://www.ivmaisoft.com/_bin/atomic_ops/libatomic_ops-7.4.2.tar.gz
$ ./autogen.sh
$ ./configure
[..]
$ make --version
GNU Make 3.81
[..]
$ make all
[..]
$ ./asy -dir ./base -config "" -noprc ../transparency-3d-bug.asy
Segmentation fault: 11
Other examples seem to work normally. In particular, the manual doc/asymptote.pdf
is built correctly without problems.
TeXLive-2016 is bundled with Asymptote version 2.38, which produces the following picture, which is not correct either:
from asymptote.
Yes, that is how the example should look with OpenGL (which as is well known, doesn't handle transparency perfectly). The segmentation fault you are reporting is likely coming from your graphics library. Which version of freeglut are you using? I recommend freeglut-3.0.0.
Your code runs fine on my machine with asy 2.40-1, even under valgrind.
from asymptote.
Yes, that is how the example should look with OpenGL (which as is well known, doesn't handle transparency perfectly)
... Oh. That was news to me.
I just have looked around on the internet a bit, and it seems to me that while using OpenGL transparency naรฏvely will fail, there are still methods to ensure that scenes are rendered correctly, for example depth peeling.
Wouldn't it be sensible to implement this in Asymptote? As far as I understand, Asymptote is a scene description language, and I was under the impression that rendering should be independent of particular technology artefacts like OpenGl not sorting triangles before blending colors. At least, that's how I would like it as a mathematician. ๐
Which version of freeglut are you using? I recommend freeglut-3.0.0.
Actually, I'm on OS X 10.9. It seems that the configure
script simply picks up the resident OpenGL
system library (framework).
EDIT: Fix version information on my OS
from asymptote.
Yes, if you are only drawing triangles, you can split them along any intersections (that tutorial didn't even consider this possibility) and then sort the pieces. However, we are rendering smooth Bezier surfaces and before version 2.39, Asymptote delegated all rendering to the GLU library. That library is deprecated so, in preparation for the ultimate demise of the GLU library, as of version 2.39, Asymptote uses it's own in-house renderer for Bezier triangles, curves, and surfaces. So yes, it should now be possible to implement splitting and sorting at the triangle level. I'll reopen this issue as a reminder.
Can you recompile with
make clean
make CFLAGS=-g
and use the debugger (or valgrind) to produce a traceback that shows were the segmentation fault occurred? Do any other 3D examples that use OpenGL (i.e. not ones from the manual) fail?
There are many 3D examples in the Asymptote gallery and some of them use transparency.
from asymptote.
So yes, it should now be possible to implement splitting and sorting at the triangle level
Great! ๐
Can you recompile with
make clean
make CFLAGS=-g
Yesโฆ and now it produces a good .png
file without segfault! ๐ฎ However, if I run
make clean
make
again, the obtained asy
executable will segfault again when trying to render my example. ><
(Note: I am actually on OS X 10.9, sorry for the confusion.)
from asymptote.
What happens when you compile with
make CFLAGS="-g -O2"
If that doesn't work, also try -O.
from asymptote.
A partial workaround for this OpenGL bug is now implemented in
commit 31c6630
I didn't implement triangle splitting yet but transparent triangles for a single material are now sorted by their centroid depth.
I also fixed a seg fault in beziercurve.h so perhaps that issue is now resolved too.
from asymptote.
P.S. To avoid degenerate patches at the poles you should slightly adjust the theta endpoints. For example:
surface s = surface(f,(sqrtEpsilon,0),(pi-10*sqrtEpsilon,2pi),41,Spline);
from asymptote.
Much better, thanks! ๐
The segmentation fault no longer happens for me with commit af2b9b1 .
The picture is much better as well! The treatment of transparency does not yet seem to be perfect, though. If I apply your suggested fix concerning degeneracy, and now also reduce the transparency of the left sphere as a whole, changing the following two lines,
// ...
surface s = surface(f,(sqrtEpsilon,0),(pi-10*sqrtEpsilon,2pi),41,Spline);
// ...
surface s = shift(0.5X+0.5Y) * mkSphere( Gradient(green, 0.9*white, green)+opacity(0.1) );
, then I get the following picture:
The left sphere is almost invisible, except for a green piece with a weird shape. The lower boundary of this piece is shaped like a straight, horizontal line, which indicates that this rendering is probably not correct.
from asymptote.
This issue is fixed in commit c7878da.
Sorry that isn't the right fix as it breaks the original example. Commit reverted...
from asymptote.
The problem with this modified example is that triangle splitting of transparent triangles with overlapping depths has not yet been implemented.
from asymptote.
Fixed (for non-legacy OpenGL environments, meaning everywhere except MacOS X and WebGL)
in master branch and upcoming 2.71 release.
from asymptote.
Great work!
I'm hoping the 2.71 will release soon.
from asymptote.
I add some forum links, I guess/hope that the next release will fix the bugs reported in the forum, see:
Asymptote / Discussion / Help: Artifacts in 3D rendering of transparent surfaces
and
Asymptote / Discussion / Help: Status on OpenGL transparency bug
from asymptote.
Related Issues (20)
- Postscript error creating svg with libgs.so.10.02 HOT 4
- svg breakage with gs-10.03.0 HOT 1
- asy-latex one line processing
- Linking error on macOS with clang: `Undefined symbols for architecture x86_64: "_add_history"` etc. HOT 5
- Canโt compile LSP โ <boost/filesystem/directory.hpp> missing from LspCpp/src/lsp/utils.cpp HOT 1
- Algolia DocSearch integration?
- Defining struct in a loop gives confusing error message HOT 1
- Feature request: Convert tab to 4 [/8] spaces in error message reporting
- Feature request: `var oldAsin=asin;` copies the function HOT 2
- Bug: unitsize() does not work to set unitsize of other pictures HOT 2
- Feature suggestion: automatic generation of constructor HOT 1
- Documentation of cputime is in Structure section? HOT 1
- Feature suggestion: shorthand to create a picture HOT 9
- Feature suggestion: Remove `add(picture dest, picture src, pair position)` variant as it's dangerous HOT 4
- Stack traceback on error?
- Suggestion: integrate with Typst? HOT 3
- Suggestion: `envelope` type don't need `above` passed in HOT 1
- Why does the bounding box of a frame containing just a label not just the label's bounding box? HOT 1
- Suggestion: transformations for shading tools? HOT 1
- Feature suggestion: baseline specification for inclusion in LaTeX HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. ๐๐๐
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google โค๏ธ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from asymptote.