-
Notifications
You must be signed in to change notification settings - Fork 19
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
4th order NurbsPatchSurface node **not** rendered correctly! #17
Comments
Thanks for the report. I can reproduce it with latest view3dscene from GitHub. Release version looks like on your screenshot, debug version raises assertion errors at NURBS calculation (https://github.com/castle-engine/castle-engine/blob/master/src/3d/castlenurbs.pas#L264) -- so this is definitely a bug in code, something is unexpected. The I'll look into it and fix soon. |
Looks like our NURBS implementation was never ready for "periodic" knots of NURBS. We only implement "non-periodic" knot vectors, which (following the definition in "The NURBS Book", https://books.google.pl/books?id=7dqY5dyAwWkC&pg=PA67&hl=pl&source=gbs_toc_r&cad=3#v=onepage&q=nonperiodic&f=false ) means that the knot vector has Order equal points at the beginning, and similarly Order equal points at the end. Your example with teapot shows periodic NURBS knots, like
I'll look into implementing support for periodic NURBS too. I tried a simple approach to it today, but it looks like it will need more serious change of the algorithm. |
Hi Michalis, I tested my X3D-code the whole night because I thought, the mistake might be on my side, like a typo or a missing '>' or '/' -- But I found nothing... X3DOM uses the tessalation code of Ayam by Randolf Schultz (randolf.schultz@gmail.com), may-be a look into the X3DOM implementation gives a hint, how to handle 'periodic NURBS'. I hope you find a way to fix the 'periodic NURBS'-problem soon, because the NURBS-Utah-teapot is a nice show-case for what one can do with NURBS and I would like to be able to use such code also in View3DScene as well! With best regards, Elmar |
Hi Michalis, I have been trying to convert the original Renderman RIB-file of the Utah Teapot to X3D in a way that fits View3DScene's abilities (without having to rewrite the NURBS implementation) and I succeeded! I didn't use any other programs than Notepad2 and copied/pasted the original controlPoint-values from the RIB-file into my X3D-file and decorated them with some X3D-NurbsPatchSurface syntax (solid="false" order="4" dimension="4" tessellation="8" etc.), thats all! (no knots! no weight!) I could even reduce the file-size by 50%, because the original RIB-file draws the teapot actually twice (once for the toon-surface and a second time for the toon-outlines)! The resulting X3D-file works not only in View3DScene 3.18.0-snapshot, but also in freeWRL-4.3.4, OctagaPlayer-5.0.8 and X3DOM-1.8.1-dev! Of course it would be cool if View3DScene also supported periodic NURBS knots! With best regards, Elmar P.S.: Here are my files: view3dscene_issue_17-2.zip |
Cool, thanks for the information. If you don't specify the NURBS "knot vector" explicitly in X3D, we internally generate a (non-periodic) knot vector. So it makes sense that it works correctly in this case. Indeed it would be even better if view3dscene supported periodic NURBS. |
Hi Michalis,
I have found a Utah teapot that uses Bezier-patches in Renderman .RIB format here and converted it with the help of Ayam 1.26 and WhiteDune 1.212 and a lot of manual simplification to X3D/X3DOM!
Rendered with X3DOM-1.8.1-dev snapshot it looks like this:
but rendered with View3dscene 3.18.0-20190817 (zoomed to the max) it looks like this:
Am I missing something?
Because this renders O.K.! -- look here:
I don't get it! Why does the spaceship (composed of 6 order-4-NurbsPatchSurface-nodes) work and the teapot (composed of 64 order-4-NurbsPatchSurface-nodes) doesn't?
May-be because I omitted the weight-property?
It would be:
weight='1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1'
for all NurbsPatchSurface-Nodes and seems to be omittable, because according to the spec, the default weight of 1.0 is assumed for each control point.Please help me!
With best regards,
Elmar
P.S.: I attach the used files: view3dscene_issue_17.zip
The text was updated successfully, but these errors were encountered: