Page 1 of 6

Planetary code

Posted: Fri Nov 25, 2011 10:08 am
by pheonixstorm
@log0

Worked on the planet code you setup. Had to change a few things in the projects to get it to compile. Minor change, it was complaining about not being able to find boost threads. You had an absolute path listed (F:\..\..\boost instead of ../../vegastrike/boost. Once that was fixed I was able to copmile, only a few warnings.

Now running it on the other hand... first run, ogre.log showed that it couldnt find RenderSystem_GL.dll in ../bin so I had to put it down a level from data/RenderSystem_GL.dll to bin/RenderSystem_GL.dll sitting side by side with data (my test install is not standard but you should get the idea here). VS.exe is located in data (as is the other ogre dll). This problem resolved... on to the next.

Started VS up again and now the ogre log compains about

Code: Select all

03:55:59: OGRE EXCEPTION(3:RenderingAPIException): selectPixelFormat failed in Win32Window::create at ..\..\..\RenderSystems\GL\src\OgreWin32Window.cpp (line 404)
Haven't checked it out yet. Will probably do so tomorrow. I have attached the full ogre.log if you want to view it.

Re: Planetary code

Posted: Fri Nov 25, 2011 11:24 am
by log0
Ogre should not mess with the pixel format. I hope it is not an Ogre bug. What is your windows version, graphics card? Can you try changing window parameters(fullscreen, windowed, color depth) and upload your vegastrike.config and ogre.cfg?

Re: Planetary code

Posted: Fri Nov 25, 2011 7:58 pm
by pheonixstorm
tested under win xp, nvidia 260. Will try windowed and fullscreen in win 7 before rebooting to play around in VC9 to find whats happening. If you have a working win32 binary try to zip and attach to the board or email it to me. If yours worked for you but not me we know its a config or windows error. email darklastat @ yahoo.com (no space)

Re: Planetary code

Posted: Fri Nov 25, 2011 9:07 pm
by log0

Re: Planetary code

Posted: Sat Nov 26, 2011 1:21 am
by pheonixstorm
Died in windowed and fullscreen modes. Save error in the ogre.log I posted before. From event log

Code: Select all

Faulting application name: Vegastrike.exe, version: 0.5.1.13243, time stamp: 0x4ecf9e74
Faulting module name: MSVCR90.dll, version: 9.0.30729.4974, time stamp: 0x4b7a226f
Exception code: 0x40000015
Fault offset: 0x0005beae
Faulting process id: 0x1568
Faulting application start time: 0x01ccabcefd8091c0
Faulting application path: E:\Games\VegaStrike51_b2\data\Vegastrike.exe
Faulting module path: C:\Windows\WinSxS\x86_microsoft.vc90.crt_1fc8b3b9a1e18e3b_9.0.30729.4974_none_50940634bcb759cb\MSVCR90.dll
Report Id: 41debc20-17c2-11e1-9361-002354820f97
Thats the crash. Same fault offset windowed and full.

Posting cfg and config files. Need anything else just ask.

Re: Planetary code

Posted: Sat Nov 26, 2011 10:22 am
by log0
The only difference I see is gl_accelerated_visual_on which is disabled due to my ATI graphics card.

If this doesn't help I'll have to rewrite the window setup (and probably input handling) to use Ogre.

Re: Planetary code

Posted: Sat Nov 26, 2011 6:42 pm
by Dair
I'm not sure if this is relevant as its an older post, but it might be worth looking at as it seems logical.

http://www.ogre3d.org/forums/viewtopic.php?f=5&t=27575

The only other thing I've seen mentioned is to check drivers, but I don't believe that is related directly to GL rendersystem.

Hope that helps.

Re: Planetary code

Posted: Sat Nov 26, 2011 8:39 pm
by pheonixstorm
Looks like it may be close to what we are getting now, but that particular issue was patched into ogre in 07. Good find though, maybe we can use that as a starting point to hunt this thing down.

Re: Planetary code

Posted: Sat Nov 26, 2011 9:01 pm
by log0
@pheonixstorm can you try with externalGLControl enabled?
vsogre.cpp:

Code: Select all

misc["externalGLContext"] = StringConverter::toString(winGlContext);
misc["externalGLControl"] = String("True");

Re: Planetary code

Posted: Sat Nov 26, 2011 10:15 pm
by BEZ_BASHNI
Look like I'm the next one fighting with vsogre....
00:13:28: *** Starting Win32GL Subsystem ***
00:13:28: GLRenderSystem::_createRenderWindow "Vegastrike", 1024x768 windowed miscParams: externalGLContext=131072 externalWindowHandle=854254
00:13:28: OGRE EXCEPTION(3:RenderingAPIException): selectPixelFormat failed in Win32Window::create at ..\..\..\..\..\RenderSystems\GL\src\OgreWin32Window.cpp (line 404)

Re: Planetary code

Posted: Sat Nov 26, 2011 11:05 pm
by BEZ_BASHNI
Tried to change in
plugins_w.cfg
Plugin=RenderSystem_Direct3d9

if theres no orge.cfg in /data it pop up orge lparametr screen and start in d3d
But no wonderfull planet...


00:58:39: RenderSystem Name: Direct3D9 Rendering Subsystem
00:58:39: GPU Vendor: nvidia
00:58:39: Device Name: Monitor-1-NVIDIA GeForce GTX 570
00:58:39: Driver Version: 8.17.12.8538
00:58:39: * Fixed function pipeline: yes
00:58:39: * Hardware generation of mipmaps: yes
00:58:39: * Texture blending: yes
00:58:39: * Anisotropic texture filtering: yes
00:58:39: * Dot product texture operation: yes
00:58:39: * Cube mapping: yes
00:58:39: * Hardware stencil buffer: yes
00:58:39: - Stencil depth: 8
00:58:39: - Two sided stencil support: yes
00:58:39: - Wrap stencil values: yes
00:58:39: * Hardware vertex / index buffers: yes
00:58:39: * Vertex programs: yes
00:58:39: * Number of floating-point constants for vertex programs: 256
00:58:39: * Number of integer constants for vertex programs: 16
00:58:39: * Number of boolean constants for vertex programs: 16
00:58:39: * Fragment programs: yes
00:58:39: * Number of floating-point constants for fragment programs: 224
00:58:39: * Number of integer constants for fragment programs: 16
00:58:39: * Number of boolean constants for fragment programs: 16
00:58:39: * Geometry programs: no
00:58:39: * Number of floating-point constants for geometry programs: 0
00:58:39: * Number of integer constants for geometry programs: 20480
00:58:39: * Number of boolean constants for geometry programs: 28243
00:58:39: * Supported Shader Profiles: hlsl ps_1_1 ps_1_2 ps_1_3 ps_1_4 ps_2_0 ps_2_a ps_2_b ps_2_x ps_3_0 vs_1_1 vs_2_0 vs_2_a vs_2_x vs_3_0
00:58:39: * Texture Compression: yes
00:58:39: - DXT: yes
00:58:39: - VTC: no
00:58:39: - PVRTC: no
00:58:39: * Scissor Rectangle: yes
00:58:39: * Hardware Occlusion Query: yes
00:58:39: * User clip planes: yes
00:58:39: * VET_UBYTE4 vertex element type: yes
00:58:39: * Infinite far plane projection: yes
00:58:39: * Hardware render-to-texture: yes
00:58:39: * Floating point textures: yes
00:58:39: * Non-power-of-two textures: yes
00:58:39: * Volume textures: yes
00:58:39: * Multiple Render Targets: 4
00:58:39: - With different bit depths: yes
00:58:39: * Point Sprites: yes
00:58:39: * Extended point parameters: yes
00:58:39: * Max Point Size: 10
00:58:39: * Vertex texture fetch: yes
00:58:39: * Number of world matrices: 0
00:58:39: * Number of texture units: 8
00:58:39: * Stencil buffer depth: 8
00:58:39: * Number of vertex blend matrices: 0
00:58:39: - Max vertex textures: 4
00:58:39: - Vertex textures shared: no
00:58:39: * Render to Vertex Buffer : no
00:58:39: * DirectX per stage constants: yes
00:58:39: DefaultWorkQueue('Root') initialising on thread 0A03ECB8.
00:58:39: DefaultWorkQueue('Root')::WorkerFunc - thread 0B17AC40 starting.
00:58:39: DefaultWorkQueue('Root')::WorkerFunc - thread 0B17AC70 starting.
00:58:39: DefaultWorkQueue('Root')::WorkerFunc - thread 0B17ACD0 starting.
00:58:39: DefaultWorkQueue('Root')::WorkerFunc - thread 0B17AD30 starting.
00:58:39: DefaultWorkQueue('Root')::WorkerFunc - thread 0B17ADC0 starting.
00:58:39: DefaultWorkQueue('Root')::WorkerFunc - thread 0B17ADF0 starting.
00:58:39: DefaultWorkQueue('Root')::WorkerFunc - thread 0B17AE50 starting.
00:58:39: DefaultWorkQueue('Root')::WorkerFunc - thread 0B17AEB0 starting.
00:58:39: Particle Renderer Type 'billboard' registered
00:58:39: Parsing scripts for resource group Autodetect
00:58:39: Finished parsing scripts for resource group Autodetect
00:58:39: Parsing scripts for resource group General
00:58:39: Finished parsing scripts for resource group General
00:58:39: Parsing scripts for resource group Internal
00:58:39: Finished parsing scripts for resource group Internal
00:58:39: Parsing scripts for resource group Popular
00:58:39: Parsing script OPDepthPass.program
00:58:39: Parsing script OPGreen.program
00:58:39: Parsing script OPNoiseTest.program
00:58:39: Parsing script OPOcean.program
00:58:39: Parsing script OPPlanet.program
00:58:39: Parsing script OPSky.program
00:58:39: Parsing script OPSun.program
00:58:39: Parsing script OPTerrainGouraud.program
00:58:39: Parsing script OPTerrainPhong.program
00:58:39: Parsing script OPGreen.material
00:58:39: OGRE EXCEPTION(2:InvalidParametersException): Parameter called time does not exist. in GpuProgramParameters::_findNamedConstantDefinition at ..\..\..\..\OgreMain\src\OgreGpuProgramParams.cpp (line 1433)
00:58:39: Compiler error: invalid parameters in OPGreen.material(31): setting of constant failed
00:58:39: Parsing script OPNoiseTest.material
00:58:39: Parsing script OPOcean.material
00:58:39: OGRE EXCEPTION(2:InvalidParametersException): Parameter called planetRadius does not exist. in GpuProgramParameters::_findNamedConstantDefinition at ..\..\..\..\OgreMain\src\OgreGpuProgramParams.cpp (line 1433)
00:58:39: Compiler error: invalid parameters in OPOcean.material(39): setting of constant failed
00:58:39: OGRE EXCEPTION(2:InvalidParametersException): Parameter called scaleHeight does not exist. in GpuProgramParameters::_findNamedConstantDefinition at ..\..\..\..\OgreMain\src\OgreGpuProgramParams.cpp (line 1433)
00:58:39: Compiler error: invalid parameters in OPOcean.material(41): setting of constant failed
00:58:39: OGRE EXCEPTION(2:InvalidParametersException): Parameter called atmosphereDensity does not exist. in GpuProgramParameters::_findNamedConstantDefinition at ..\..\..\..\OgreMain\src\OgreGpuProgramParams.cpp (line 1433)
00:58:39: Compiler error: invalid parameters in OPOcean.material(42): setting of constant failed
00:58:39: Parsing script OPPlanet.material
00:58:39: OGRE EXCEPTION(2:InvalidParametersException): Parameter called world does not exist. in GpuProgramParameters::_findNamedConstantDefinition at ..\..\..\..\OgreMain\src\OgreGpuProgramParams.cpp (line 1433)
00:58:39: Compiler error: invalid parameters in OPPlanet.material(27): setting of constant failed
00:58:39: OGRE EXCEPTION(2:InvalidParametersException): Parameter called patchCreationTime does not exist. in GpuProgramParameters::_findNamedConstantDefinition at ..\..\..\..\OgreMain\src\OgreGpuProgramParams.cpp (line 1433)
00:58:39: Compiler error: invalid parameters in OPPlanet.material(31): setting of constant failed
00:58:39: OGRE EXCEPTION(2:InvalidParametersException): Parameter called time does not exist. in GpuProgramParameters::_findNamedConstantDefinition at ..\..\..\..\OgreMain\src\OgreGpuProgramParams.cpp (line 1433)
00:58:39: Compiler error: invalid parameters in OPPlanet.material(32): setting of constant failed
00:58:39: OGRE EXCEPTION(2:InvalidParametersException): Parameter called viewPosition does not exist. in GpuProgramParameters::_findNamedConstantDefinition at ..\..\..\..\OgreMain\src\OgreGpuProgramParams.cpp (line 1433)
00:58:39: Compiler error: invalid parameters in OPPlanet.material(39): setting of constant failed
00:58:39: OGRE EXCEPTION(2:InvalidParametersException): Parameter called atmosphereRadius does not exist. in GpuProgramParameters::_findNamedConstantDefinition at ..\..\..\..\OgreMain\src\OgreGpuProgramParams.cpp (line 1433)
00:58:39: Compiler error: invalid parameters in OPPlanet.material(43): setting of constant failed
00:58:39: OGRE EXCEPTION(2:InvalidParametersException): Parameter called scaleHeight does not exist. in GpuProgramParameters::_findNamedConstantDefinition at ..\..\..\..\OgreMain\src\OgreGpuProgramParams.cpp (line 1433)
00:58:39: Compiler error: invalid parameters in OPPlanet.material(44): setting of constant failed
00:58:39: OGRE EXCEPTION(2:InvalidParametersException): Parameter called atmosphereDensity does not exist. in GpuProgramParameters::_findNamedConstantDefinition at ..\..\..\..\OgreMain\src\OgreGpuProgramParams.cpp (line 1433)
00:58:39: Compiler error: invalid parameters in OPPlanet.material(45): setting of constant failed
00:58:39: Parsing script OPSky.material
00:58:39: OGRE EXCEPTION(2:InvalidParametersException): Parameter called planetRadius does not exist. in GpuProgramParameters::_findNamedConstantDefinition at ..\..\..\..\OgreMain\src\OgreGpuProgramParams.cpp (line 1433)
00:58:39: Compiler error: invalid parameters in OPSky.material(42): setting of constant failed
00:58:39: OGRE EXCEPTION(2:InvalidParametersException): Parameter called scaleHeight does not exist. in GpuProgramParameters::_findNamedConstantDefinition at ..\..\..\..\OgreMain\src\OgreGpuProgramParams.cpp (line 1433)
00:58:39: Compiler error: invalid parameters in OPSky.material(44): setting of constant failed
00:58:39: OGRE EXCEPTION(2:InvalidParametersException): Parameter called atmosphereDensity does not exist. in GpuProgramParameters::_findNamedConstantDefinition at ..\..\..\..\OgreMain\src\OgreGpuProgramParams.cpp (line 1433)
00:58:39: Compiler error: invalid parameters in OPSky.material(45): setting of constant failed
00:58:39: Parsing script OPSun.material
00:58:40: Parsing script OPTerrainGouraud.material
00:58:40: OGRE EXCEPTION(2:InvalidParametersException): Parameter called lightPosition does not exist. in GpuProgramParameters::_findNamedConstantDefinition at ..\..\..\..\OgreMain\src\OgreGpuProgramParams.cpp (line 1433)
0:58:40: Compiler error: invalid parameters in OPTerrainGouraud.material(32): setting of constant failed
00:58:40: Parsing script OPTerrainPhong.material
00:58:40: Finished parsing scripts for resource group Popular
00:58:44: D3D9 Device 0x[0BAEC7C0] entered lost state
00:58:44: D3D9 : WARNING - disabling VSync in windowed mode can cause timing issues at lower frame rates, turn VSync on if you observe this problem.

Re: Planetary code

Posted: Sun Nov 27, 2011 12:44 am
by log0
@BEZ_BASHNI

Creative, but absolutely wrong direction. I need to remove ogre.cfg so that people don't get this idea again.

If you read the above posts you will notice that you have the exactly same problem as pheonixstorm. A possible solution is also discussed. Add misc["externalGLControl"] = String("True"); at line 143 in vegastrike/src/vsogre.cpp. If it still crashes, then we are screwed.

Re: Planetary code

Posted: Sun Nov 27, 2011 3:24 am
by pheonixstorm
Only when it comes to using ogre. We can still roll our own, which is what I would prefer anyway. I mentioned 2 or 3 examples opensource projects we can use as a template, though I will have to look and see if I also posted links for them. I will add them in here in a few hours, gotta get some work done and get the kids in bed.

Re: Planetary code

Posted: Sun Nov 27, 2011 9:09 am
by BEZ_BASHNI
Creative, but absolutely wrong direction.
I agree -myself have ubunty as a secondary os and I dont wish to lock project to MS-locked shit.

The OGRE forum is full with this : selectPixelFormat issue.
I tried to toggle misc["externalGLControl'],misc["externalGLContext"] -no success.
But I can run all ogre demos in opengl mode on my config...So the solution must be there...

Re: Planetary code

Posted: Sun Nov 27, 2011 9:50 am
by log0
Only when it comes to using ogre. We can still roll our own, which is what I would prefer anyway.
My intention has been to use it as a starting point to incrementally move all graphics to ogre. I think I'll check ghoulsblade2's code base and maybe add the planet renderer to it.

Re: Planetary code

Posted: Sun Nov 27, 2011 11:23 am
by BEZ_BASHNI
IT WORKS !!! NICE PLANET!


size_t winHandle = reinterpret_cast<size_t>(info.window);
size_t winGlContext = reinterpret_cast<size_t>(info.hglrc);
misc["externalWindowHandle"] = Ogre::StringConverter::toString(winHandle);

misc["externalGLContext"] = Ogre::StringConverter::toString(winGlContext);
misc["externalGLControl"] = Ogre::String("True");

it should work from the beginning , but did a wrong compiling sequence...

Re: Planetary code

Posted: Sun Nov 27, 2011 6:38 pm
by log0
Finally some good news.

I've had a look at vegastrike techniques. They seem to map quite well to ogre materials. I've ported opaque.technique to an opaque.material. It loads and compiles the shaders(we can reuse vs shaders here). If I figure out how to pass the mesh data to ogre, we could have almost all stuff rendered in ogre soon.

Re: Planetary code

Posted: Sun Nov 27, 2011 8:13 pm
by BEZ_BASHNI
Something about the planets rendering - we need to direct the lightsource vector from the local sun. Or remove the lightsource vector at all and put a lightsource into the local sun. I was adjusting gravity model using the provided sol system - theres total mess with the planets shadows - like you fly from the sol to the earth , and the earth's sol side is in darkness.

Re: Planetary code

Posted: Sun Nov 27, 2011 8:34 pm
by log0
The sun needs a different shader(right now everything is a planet) and parameters. The main light source need to be set(it is not atm) and a few other things I forgot. The whole thing is work in progress as I wrote in the other thread.

Re: Planetary code

Posted: Sun Nov 27, 2011 11:33 pm
by pheonixstorm
BEZ_BASHNI wrote:Something about the planets rendering - we need to direct the lightsource vector from the local sun. Or remove the lightsource vector at all and put a lightsource into the local sun. I was adjusting gravity model using the provided sol system - theres total mess with the planets shadows - like you fly from the sol to the earth , and the earth's sol side is in darkness.
Ah the joy of the little bugs. I wonder if anyone even thought of this before or if it was just never thought of as a priority.

Re: Planetary code

Posted: Mon Nov 28, 2011 12:12 am
by Dair
Its good to see you guys got it sorted out and working, I'm looking forward to seeing it action but work keeps me pretty busy these days so I'm staying focused on just learning about VS as whole at this stage.

I think a move towards using OGRE3D would be a great idea, because its a well developed Rendering engine with a strong community that constantly advances its features and you can leverage a lot of that in VS over time as you continue to develop the core systems.

Re: Planetary code

Posted: Tue Nov 29, 2011 6:13 pm
by log0
Sorry guys couldn't resist http://www.youtube.com/watch?v=GOwj-gu8_Z4

Have been playing with the LOD a bit, still using the ugly shader.

Re: Planetary code

Posted: Tue Nov 29, 2011 9:12 pm
by klauss
Nice.

Pardon the ignorance (didn't read all of this thread).

Can you use VS's planet technique when far away, and switch to generated terrain when up close?

I bet you could reuse the ground shader when up close too, making it look a lot better. But a specialized shader would probably be best. If you could feed from the planet's height map, it would also look a lot better (assuming you don't already).

Is it integrated into VS code? (seems like it).

Re: Planetary code

Posted: Wed Nov 30, 2011 4:27 am
by pheonixstorm
Its not committed yet. I'm working on that tonight. Patched from the last addition from log0. Just need to retest and I will be sending it into my branch along with the code under review. It does require ogre for now.. but i'm tryin to get log0 to write VS integrated code so we can make this part of the core engine.

Re: Planetary code

Posted: Wed Nov 30, 2011 5:37 pm
by log0
Can you use VS's planet technique when far away, and switch to generated terrain when up close?
I hope to avoid switching. The lowest lod atm is about 3k vertices per planet, should be low-poly enough?

Btw the normals are per vertex atm. The planet can get vertex heavy to get the details rendered. It should be possible to reduce vertex load by switching to normal maps, but that means shaders would be a requirement. On the other side, even mobile phones are capable to run shaders nowadays.
I bet you could reuse the ground shader when up close too, making it look a lot better. But a specialized shader would probably be best. If you could feed from the planet's height map, it would also look a lot better (assuming you don't already).
The shader in the video is used for debugging and profiling (lod and normals), kept as simple as possible.
write VS integrated code
?