Jump to content

Anti-aliased cubes and spheres


Shaping
 Share

Recommended Posts

I need to render very clean-looking maximally anti-aliased cubes and spheres. Can anyone make specific suggestions?

 

I rendered the basic cube, but see a lot of jaggies. Must I write a custom shader to render the cube smoothly? Has anyone already done this?

 

Also, I rendered a sphere with CreateSphere (32) and with CreateSphere (100), and saw no difference in boundary smoothness. This is confusing because I recently tested DX Studio, in which I imported a sphere of 200 slices (about 20,000 polygons), and it rendered extremely smoothly in that WebGL-based engine. I feel limited, however, by the Javascript; so I decided to work with Leadwerks, instead. I need very smooth spheres too. So I have two questions really:

 

 

How do I create extremely smooth cubes and spheres?

 

Will Leadwerks ever target the Web directly as a platform, via WebGL?

 

 

Regarding WebGL, the interactivity is great and the deployment model is very simple.

Link to comment
Share on other sites

It depends how the triangles are arranged in the sphere. In Leadwerks there is a pretty smooth setup of triangles with 32 sectors. With 16 sectors you can see slight edges still.

 

Leadwerks has the commadn SetAntialias(1); to enable antialiasing, but there has been also improved AA shaders in the forum, which you can just copypaste into the existing antialias shader.

 

Fog, DoF and Bloom also makes things look smoother.

Ryzen 9 RX 6800M ■ 16GB XF8 Windows 11 ■
Ultra ■ LE 2.53DWS 5.6  Reaper ■ C/C++ C# ■ Fortran 2008 ■ Story ■
■ Homepage: https://canardia.com ■

Link to comment
Share on other sites

Leadwerks Engine uses a deferred renderer and does not have MSAA. You can use the framework commands and enable antialiasing, but this is a post processing filter and does not have the same quality as MSAA.

 

Leadwerks3D supports MSAA, even with the deferred renderer, as the feature we requested three years ago is finally supported. biggrin.png

 

I have no plans to pursue WebGL, but there are other online platforms we are looking into. We'll probably end up supporting a variety of online platforms, because none are completely perfect, and each has tradeoffs.

My job is to make tools you love, with the features you want, and performance you can't live without.

Link to comment
Share on other sites

Leadwerks Engine uses a deferred renderer and does not have MSAA. You can use the framework commands and enable antialiasing, but this is a post processing filter and does not have the same quality as MSAA.

 

Leadwerks3D supports MSAA, even with the deferred renderer, as the feature we requested three years ago is finally supported. biggrin.png

 

I have no plans to pursue WebGL, but there are other online platforms we are looking into. We'll probably end up supporting a variety of online platforms, because none are completely perfect, and each has tradeoffs.

 

Is the MSAA technique being used in WebGL? If so, it looks extremely good, and I have no complaints.

 

I'm concerned now because I see jagged sphere outlines when rendering a sphere with 64 slices in LE2.5 EK. That one sphere took more than 5 seconds to compose while the graphic window was opening. My simulation contains many (dozens) spheres.

 

I'm happy to see that you have the good stuff slated for Leadwerks3D, but what should I do in the meantime? Can I test a beta very soon, like...now? I need very basic rendering facilities: two geometric primitives, flat text, a camera I can move (pan, zoom) with a perspective or orthographic projection, and one or two lights--nothing very fancy. I don't need the editor. I need only the C-API.

 

Can you explain the problem with WebGL? Does it not scale well? Is deferred rendering not possible? It seems to be the forthcoming standard for Web-based graphics. Is there a better alternative?

Link to comment
Share on other sites

It depends how the triangles are arranged in the sphere. In Leadwerks there is a pretty smooth setup of triangles with 32 sectors. With 16 sectors you can see slight edges still.

 

Leadwerks has the commadn SetAntialias(1); to enable antialiasing, but there has been also improved AA shaders in the forum, which you can just copypaste into the existing antialias shader.

 

Fog, DoF and Bloom also makes things look smoother.

 

Does anyone happen to have shaders that draw a fully anti-aliased sphere and cube?

Link to comment
Share on other sites

It depends how the triangles are arranged in the sphere. In Leadwerks there is a pretty smooth setup of triangles with 32 sectors. With 16 sectors you can see slight edges still.

 

Leadwerks has the commadn SetAntialias(1); to enable antialiasing, but there has been also improved AA shaders in the forum, which you can just copypaste into the existing antialias shader.

 

Fog, DoF and Bloom also makes things look smoother.

 

How do I learn more about the "existing antialias shader"?

 

I tried the above SetAntialias(1), and the program hung.

Link to comment
Share on other sites

It works when you create your project with Project Wizard, which initializes all the needed stuff for Framework.

 

No, it's not working for me. I am using ProjectBuilder now, always, and it is very convenient (except when selecting the project directory).

 

When I use SetAntialias(1), the program hangs.

 

Also, I tried switching the camera projection to orthographic and that produces a black scene. I used CameraProjMode (camera, 0) to do this.

 

A perspective projection seems to be the default: CameraProjMode (camera, 1).

Link to comment
Share on other sites

It should work for everyone. I think the newest version has also VS2010 templates, but you can open a VS2008 project with VS2010 too, and it will convert it. However, it's better to use Code::Blocks, because it creates faster code and compiles also much faster, and loads up much faster. The new VS2012 is quite horrible as it takes like 2 minutes to completely even load a project.

Ryzen 9 RX 6800M ■ 16GB XF8 Windows 11 ■
Ultra ■ LE 2.53DWS 5.6  Reaper ■ C/C++ C# ■ Fortran 2008 ■ Story ■
■ Homepage: https://canardia.com ■

Link to comment
Share on other sites

It should work for everyone. I think the newest version has also VS2010 templates, but you can open a VS2008 project with VS2010 too, and it will convert it. However, it's better to use Code::Blocks, because it creates faster code and compiles also much faster, and loads up much faster. The new VS2012 is quite horrible as it takes like 2 minutes to completely even load a project.

 

Noted. I may switch to Code::Blocks.

 

I tried the demo in which you switch between ortho (F1) and perspective (F2), but there was no difference in the appearance of the cube, except that it stopped rotating in the ortho case. Does anyone understand the problem here?

Link to comment
Share on other sites

Noted. I may switch to Code::Blocks.

 

I tried the demo in which you switch between ortho (F1) and perspective (F2), but there was no difference in the appearance of the cube, except that it stopped rotating in the ortho case. Does anyone understand the problem here?

 

...

 

Is there a working demo of orthographic and perspective camera projections?

Link to comment
Share on other sites

No, it's not working for me. I am using ProjectBuilder now, always, and it is very convenient (except when selecting the project directory).

 

When I use SetAntialias(1), the program hangs.

 

Also, I tried switching the camera projection to orthographic and that produces a black scene. I used CameraProjMode (camera, 0) to do this.

 

A perspective projection seems to be the default: CameraProjMode (camera, 1).

 

...

 

This bit of code uses 2 for orthographic, not 0 as above.

 

 

CameraProjMode

  • C: void CameraProjMode( TEntity camera, int projMode )
  • C++: void Body::SetProjMode( const ProjectionMode& mode ) Where mode is one of NOPROJECTION, PERSPECTIVE or ORTHOGRAPHIC
  • BlitzMax: CameraProjMode( camera:TCamera, projMode:Int )
  • Pascal: procedure CameraProjMode ( camera:THandle; projmode:Integer );

Sets the projection mode for the specified camera. 0 - Nothing 1 - Perspective projection (default) 2 - Orthographic projection Attention: Orthographic project may not work correctly with lighting, various shaders and unproject commands.

Link to comment
Share on other sites

...

 

This bit of code uses 2 for orthographic, not 0 as above.

 

 

CameraProjMode

  • C: void CameraProjMode( TEntity camera, int projMode )
  • C++: void Body::SetProjMode( const ProjectionMode& mode ) Where mode is one of NOPROJECTION, PERSPECTIVE or ORTHOGRAPHIC
  • BlitzMax: CameraProjMode( camera:TCamera, projMode:Int )
  • Pascal: procedure CameraProjMode ( camera:THandle; projmode:Integer );

Sets the projection mode for the specified camera. 0 - Nothing 1 - Perspective projection (default) 2 - Orthographic projection Attention: Orthographic project may not work correctly with lighting, various shaders and unproject commands.

 

 

Can anyone tell me why I can't make an orthographic projection work in LE2.5 EK? Even the tutorial provided to demonstrate the difference between perspective and ortho projections seems to be broken. Can anyone explain the problem, tell me what I'm missing, or provide a fix? I can't do any work on my simulation without an ortho projection.

Link to comment
Share on other sites

You get a dynamically adjustable orthogonal projection by increasing the camera zoom, and then scaling the models down and/or moving the camera further away.

Ryzen 9 RX 6800M ■ 16GB XF8 Windows 11 ■
Ultra ■ LE 2.53DWS 5.6  Reaper ■ C/C++ C# ■ Fortran 2008 ■ Story ■
■ Homepage: https://canardia.com ■

Link to comment
Share on other sites

You get a dynamically adjustable orthogonal projection by increasing the camera zoom, and then scaling the models down and/or moving the camera further away.

 

I increased and decreased zoom. I don't know what the default FOV is, but suppose that it's large enough to show some visible difference between perspective and ortho renderings of the cube. I don't, though, see any evidence of an ortho projection. Are you saying this actually works in the demo mentioned? Did you try the demo? Switching between ortho and perspective shows no change at all, except for the stopping of the rotating cube in the ortho case. If you place a sphere, you'll see a prolate or oblate shape, not a spherical one.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...