PureBasic Forum
https://www.purebasic.fr/english/

yes, next step, next problem, WorldShadows()
https://www.purebasic.fr/english/viewtopic.php?f=36&t=73198
Page 1 of 2

Author:  marc_256 [ Mon Jul 15, 2019 6:01 pm ]
Post subject:  yes, next step, next problem, WorldShadows()

Yes, next problem

Without using WorldShadows(), the program works fine.
When I use this ...

Code:
WorldShadows(#PB_Shadow_Additive, 10000, $202020)
or
WorldShadows(#PB_Shadow_Modulative, -1, RGB(255, 0, 0))


The program quits, without any error message ?

I use WIN 10 - PB5.71B1x64


marc

Author:  Samuel [ Mon Jul 15, 2019 8:32 pm ]
Post subject:  Re: yes, next step, next problem, WorldShadows()

Do the world shadows work in any of purebasic's example shadow programs? Have you tried opengl and directx?
Do you have a very high poly entity in your example? That could be causing the internal 16 bit vertex/index buffers to be out of bounds when stencil shadows are enabled.

Author:  marc_256 [ Tue Jul 16, 2019 1:35 pm ]
Post subject:  Re: yes, next step, next problem, WorldShadows()

hi Samuel,

When I test the PB examples, they works very well ...
And with my robot meshes noting is working.

And yes, all my meshes of the robot are very high poly entity's ...
So, thank you, now I know why PB is not working at all.

Is this a OGRE problem or a PB problem ?
And can this be updated ?

marc

Author:  IdeasVacuum [ Tue Jul 16, 2019 2:28 pm ]
Post subject:  Re: yes, next step, next problem, WorldShadows()

Hi Marc

....potentially, the OpenGL Gadget would work better with large meshes - that is one reason why most of the CAD-CAM community is using OpenGL.

Author:  marc_256 [ Tue Jul 16, 2019 3:16 pm ]
Post subject:  Re: yes, next step, next problem, WorldShadows()

Hi IdeasVacuum,

This are my compiler settings

Image


What I want to know now, is this PB limit problem or OGRE limit problem ?

thanks,
marc

Author:  falsam [ Tue Jul 16, 2019 3:46 pm ]
Post subject:  Re: yes, next step, next problem, WorldShadows()

Hello Marc

Use InitEngine3D(#PB_Engine3D_DebugLog) and look at the file Ogre.log

The subsystem OpenGL is a solution (Water creation does not work with the OpenGL subsystem).
You can also install DirectX9c end user. This is what I did with Windows10 :wink:

Author:  marc_256 [ Tue Jul 16, 2019 3:53 pm ]
Post subject:  Re: yes, next step, next problem, WorldShadows()

Hello falsam,
thanks for the tip ... go to try it in a second.

@IdeasVacuum
do you mean I need to learn OpenGL to use the OpenGL gadget ? :evil: :twisted:

marc

Author:  Samuel [ Tue Jul 16, 2019 5:47 pm ]
Post subject:  Re: yes, next step, next problem, WorldShadows()

marc_256 wrote:
When I test the PB examples, they works very well ...
And with my robot meshes noting is working.

And yes, all my meshes of the robot are very high poly entity's ...
So, thank you, now I know why PB is not working at all.

Is this a OGRE problem or a PB problem ?
And can this be updated ?

Hmm, sounds like you are exceeding the limit. The PB team could change the buffers to 32 bit internally. It should solve the crashing. The problem would be that stencil shadows aren't meant for high poly meshes. Performance wise you'll be getting major slowdowns the larger the mesh.
Instead you could try breaking up your robots into smaller entities which should allow the stencil shadows to work. Try keeping each entity at or below 30000 vertices/faces.

You could also try texture shadows which are faster than stencils but then you are limited to entities being casters or receivers. They can't be both at the same time. Reason being is these texture shadows are using a simple technique with no depth system which is way self shadowing is not possible.

Author:  marc_256 [ Tue Jul 16, 2019 8:04 pm ]
Post subject:  Re: yes, next step, next problem, WorldShadows()

To find out where the problem is,
I eliminated almost all parts except some ...

here the result

Image

Seems to work well, with a very limited number of entity's.
Quote:
The PB team could change the buffers to 32 bit internally.

So yes, need 32 bits ...


marc

Author:  IdeasVacuum [ Tue Jul 16, 2019 8:34 pm ]
Post subject:  Re: yes, next step, next problem, WorldShadows()

....and 64bit buffers on 64bit OS?

Author:  IdeasVacuum [ Tue Jul 16, 2019 11:41 pm ]
Post subject:  Re: yes, next step, next problem, WorldShadows()

Quote:
do you mean I need to learn OpenGL to use the OpenGL gadget ?


Well it's similar - especially in terms of how confusing and difficult it can be to get materials to look real :mrgreen:
However, there is a lot of OpenGL information online, because it is so popular. It's possibly more appropriate for your project as the sub-set of Ogre that PB supports is more in the direction of Games rather than Engineering.

I do wish Fred had added a raft of functions at the time the OpenGL Gadget was introduced. One thing in it's favour is the seamless movement of the mouse between the OpenGL gadget and any other gadget, without requiring extra code to track the mouse. If only there was an Ogre Gadget........

Author:  Samuel [ Tue Jul 16, 2019 11:53 pm ]
Post subject:  Re: yes, next step, next problem, WorldShadows()

IdeasVacuum wrote:
....and 64bit buffers on 64bit OS?

That might be a bit overkill. 32 bit buffers alone would increase the count from 65536 to 4294967296 per entity.

@marc_256
Did you model those entities using an external software like blender? If you have the xml exports of them you can manually change the use32bitindexes="false" to "true". That might solve the stencil shadow issues you are having.
With my custom exporter I've imported meshes into PB/OGRE that had a couple hundred thousand polys. I don't remember if I ever tried them with stencil shadows though.

Author:  box_80 [ Wed Jul 17, 2019 1:24 am ]
Post subject:  Re: yes, next step, next problem, WorldShadows()

Have the option to use 16 or 32 bit buffers for a entity would be nice to have depending on what the project needs.

Author:  applePi [ Wed Jul 17, 2019 4:51 am ]
Post subject:  Re: yes, next step, next problem, WorldShadows()

try MeshLab tool
there are options to reduce the number of vertices and faces, look this option:
Filters -> cleaning and repairing -> merge close vertices
Image
but this page is better: https://www.shapeways.com/tutorials/polygon_reduction_with_meshlab since they don't accept more than 1 million polygons for 3D printing, they describe how to reduce it in detail
it is possible that blender also can reduce the number of vertices and faces, search for "how to reduce number of vertices in blender"
i have an old 32bit version of meshLab, but in their site seems they provide only 64bit version
http://www.meshlab.net/

Author:  marc_256 [ Wed Jul 17, 2019 8:39 am ]
Post subject:  Re: yes, next step, next problem, WorldShadows()

Samuel wrote:
IdeasVacuum wrote:
....and 64bit buffers on 64bit OS?

That might be a bit overkill. 32 bit buffers alone would increase the count from 65536 to 4294967296 per entity.

@marc_256
Did you model those entities using an external software like blender? If you have the xml exports of them you can manually change the use32bitindexes="false" to "true". That might solve the stencil shadow issues you are having.
With my custom exporter I've imported meshes into PB/OGRE that had a couple hundred thousand polys. I don't remember if I ever tried them with stencil shadows though.



Did some tests, can be me but it seems, not the polys per entity is the problem,
but the total amount of polys of all entity's together !!!
I will do some extra tests ...

1) I use a CAD program to build and develop the mechanical parts, and export them via COLLADA

2) I import them in BLENDER to position, and give them a material, and export them via OGRE exporter.
and get a Geometry.mesh.xml file. Who I convert to a vertices / face data file.

3) I integrate this file in to my PB program.


marc

Page 1 of 2 All times are UTC + 1 hour
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
http://www.phpbb.com/