News:

Congratulations!
 You've won the News Item Lottery! Your prize? Reading this news item! :)

Hardware accelerated display, OpenGL back-end & Simutrans 3D

Started by eddielexx, January 02, 2010, 03:38:33 PM

Previous topic - Next topic

0 Members and 2 Guests are viewing this topic.

Markohs

Using a perspective camera whould require deforming the current render, requires a lot more of work, let's start on orthografic I think, maybe it doesn't look so bad, after all we've been using it for lots of time in simutrans.


jamespetts

Hmm - why does deforming the current render require more work? At least, why does it require more work for you? Is not the extra work required for that already in the Ogre 3D engine...? The cube on the left appears to be a very odd shape indeed, with the back part larger than the front (as one expects perspective and therefore for the back to be smaller than the front of it is an evenly sized cube).

(Incidentally - Zeno's tram is most impressive! Did I tell you where all the Pak128.Britain models are located? They're all open source and in a big repository...)
Download Simutrans-Extended.

Want to help with development? See here for things to do for coding, and here for information on how to make graphics/objects.

Follow Simutrans-Extended on Facebook.

Markohs

No, the render doesn't require more work, ogre does this automatically. I was refering to deform the current 2D map cells in the 2D pixelart, so they align to a projection camera render cells, but maybe I can find an acceptable solution.

Yea maybe you told me where they were but it can't find it now, tell me the link so I can make some experiments. :)

prissi

Perhaps you could first starting to tilt vehicles on slopes. That would give you an estimate of the problems (tilting must start half a tile different to actually entering the slope and so on.) Not completely unsolvable (there was even a path a long long time agon on this, which did not take it into account and thus did not look so great.)

To aviece that, you may need another vehcile variable, like
"starting_tilt_step" (From this tile on to the end of step_next the tilt will increase)
"full_tilt_step_from/until" (Full tilt maintained until this step)
"ending_tilt_step" (stopping tilting)
Those are most likely set by "hop()"

Calc_height might be a good candidate to do the tilting. (Unfourtunately this routine is already one of the most called ones ... :( )

jamespetts

Quote from: Markohs on January 24, 2012, 10:20:59 AM
No, the render doesn't require more work, ogre does this automatically. I was refering to deform the current 2D map cells in the 2D pixelart, so they align to a projection camera render cells, but maybe I can find an acceptable solution.

Yea maybe you told me where they were but it can't find it now, tell me the link so I can make some experiments. :)

Ahh - perhaps it could be set up so that it uses perspective mode for proper models? It'd be worth finding a workaround for this issue, as orthographic mode is distractingly peculiar.

As for Blender repositories, see here. Some of my latest things have not been uploaded there yet, but you have enough to be getting on with, I think.
Download Simutrans-Extended.

Want to help with development? See here for things to do for coding, and here for information on how to make graphics/objects.

Follow Simutrans-Extended on Facebook.

missingpiece

Quote from: Markohs on January 24, 2012, 12:33:48 AM...if we can add lights to models (headlamp or passenger cars inner light), etc...
Oh, gee !!! Lights inside the train which light up the ground and near trees where the vehicle is passing by ?!  :o

Quote from: Markohs on January 24, 2012, 10:20:59 AMI was refering to deform the current 2D map cells in the 2D pixelart, so they align to a projection camera render cells, but maybe I can find an acceptable solution.
I would have to see it in a mockup to know if that is a problem. But frankly, the billboard approach to bringing 2D pixel art into a 3D scene will create much worse artifacts than cell border and building ground texture not exactly mapping...

Also, with James virtually jumping up and down in anticipation, my guess is the drag to create 3D-mature paksets will be sufficient.

prissi

I think the amount of work needed to have acceptable models for a 3D pak set is completely underestimated. You cannot simply use blender model, or you would end up with ridiculus polygon counts fast. Thus you need to create a sufficiently detailed texture on a simple modell. I am not sure, if there is any good way to automize this.

Markohs

Well, step by step, right now I have other things in my TODO:

- OIS::Keyboard mapping to Simutrans events (not so easy because of multilanguage)
-  replace dr_flush code with blit() code in texture layers (requires uncompressed images in imd* images, simgraph.cc)
- Find one way to hook a periodic renderframe() on the code, since simintr.cc -> intr_refresh_display is only called when world is created, not on initial dialogs (language, pakset selection,banner and load ticker). Right now I'm just rendering on dr_flush, dr_textur is not an alternative vecause it's called more than once each frame.
- Minor mouse movement fixes.
- display_img_blend is not working ok, related to "Map player/daynight colors to the correct A1R5G5B5 value, or even use 32-bit color precision A8R8G8B8 for gradual transparencies".

prissi

THe drawing during start is handled by modal_dialogue() change it and intr_refresh_display should be enough.

sdog

Quote from: prissi on January 24, 2012, 01:09:46 PM
I think the amount of work needed to have acceptable models for a 3D pak set is completely underestimated. You cannot simply use blender model, or you would end up with ridiculus polygon counts fast. Thus you need to create a sufficiently detailed texture on a simple modell. I am not sure, if there is any good way to automize this.
The way to go is typically to build avery detailed model first. From this a set of low poly models for each LOD (if aplicable) is generated as are shadow maps etc. Typically most work is mapping the surface of the model to a flat mapping (uv wrapping), this often is not trivial.

ps.:  i often have the feeling of samming this thread, however the matter of 3d objects is something one should be aware of, should we have a new thread for this?

Ters

Perspective mode also makes interacting with the world harder. Not just to program, but for players too. When drawing a road into the distance, a small uninterntional movement could make the road much longer than originally intended. Not so much a problem when the camera angle is fixed like now, but I suspect few want to move to 3D and keep it that way.

A perspective mode for just viewing the world would still be great, sometime far into the future, when all graphics have been adapter to 3D. I liked the way you could attach the camera to a train in Railroad Tycoon 3 and see everthing from the trains perspective.

Markohs

#291

@prissi, ok, thank you, I'll hook the render() there.
@sdog, we still don't know the details of how should the models/textures be, we have to refine that seeing the memory/performance we achieve.

Seeing there is enthusiasm to see some fast results I decided to postpone my TODO list a bit more and I'm already adding the code to see some 3D objects on top of the map now.

This way we can see some results. it won't have clipping yet, so the renders can be on top of other items they shoudn't.

Now we have 3 layers (from back to front):

- 3D background (nothing here yet)
- current 2D simutrans
- 3D objects.

All this layers are alpha blended. Will post some screenshots when I have it working.

Markohs

#292
You can download a new build here, this time it doesn't ship any pak, to make the zip smaller.

you can see a rotating ogre head on the center to check the effect of the extra 3D layer. It's a orthogonal camera, see how it doesn't look so bad, james. The same object rendered with a perspective camera looks like this:




Right now I'm trying make the camera move with the 2D viewport, I remember seeing a graph or some page with the camera angles you use on your blender renders, but can't find it, anyone knows were can I find that information?

If anyone wants to play around the mesh is taken from media/models/ogrehead.mesh, and media/materials/scripts is scanned for material descriptions, you can use OgreBlenderExporter fo put your blender creatins there, but you will need to make a SINGLE mesh of your model first (all your creations I saw so far were composition of meshes, I made one export from one station that looked cool, but don't have it here now at this computer).

Remember you might need to update directx or OpenGL http://www.microsoft.com/download/en/details.aspx?displaylang=en&id=35 and install C++ redistributables  http://www.microsoft.com/download/en/details.aspx?displaylang=en&id=5555

I'd be happy to hear your experiences trying it. I'm aware of:

- Background is blue now, I'm aware transparencies won't work (as mouseover, station coverage etc)
- It's slower than the SDL version
- Keyboard doesn't work correctly
- Window resize should work now
- There is a double mouse cursor

Should look similar (and with acceptable framerate at that zoom level) to:


jamespetts

Hmm, not working for me - does nothing on attempted startup.
Download Simutrans-Extended.

Want to help with development? See here for things to do for coding, and here for information on how to make graphics/objects.

Follow Simutrans-Extended on Facebook.

Markohs

what was the window like, full black? did the music started to play?

jamespetts

Download Simutrans-Extended.

Want to help with development? See here for things to do for coding, and here for information on how to make graphics/objects.

Follow Simutrans-Extended on Facebook.

Markohs

 Can you try to start it with -debug 1 -log 1 and check the simu.log file? and the "ogre.log" that's created on the same folder than the executable, please. Maybe there is some error that shows up there, I tried it again here and it works perfectly.

Also, can you edit the "plugin.cfg", uncomment the "Plugin=RenderSystem_GL" line and delete the file "ogre.cfg"?

Thank you for your help. ;)

prissi

#297
If I delete Ogre.cfg, and select D3D I see a window with a pointer and then the music plays, so it is obviously starting up, while the screen stays violett. With GL as rederer, not even a GDI windows opens.

With opengl

16:57:52: Creating resource group General
16:57:52: Creating resource group Internal
16:57:52: Creating resource group Autodetect
16:57:52: SceneManagerFactory for type 'DefaultSceneManager' registered.
16:57:52: Registering ResourceManager for type Material
16:57:52: Registering ResourceManager for type Mesh
16:57:52: Registering ResourceManager for type Skeleton
16:57:52: MovableObjectFactory for type 'ParticleSystem' registered.
16:57:52: OverlayElementFactory for type Panel registered.
16:57:52: OverlayElementFactory for type BorderPanel registered.
16:57:52: OverlayElementFactory for type TextArea registered.
16:57:52: Registering ResourceManager for type Font
16:57:52: ArchiveFactory for archive type FileSystem registered.
16:57:52: ArchiveFactory for archive type Zip registered.
16:57:52: DDS codec registering
16:57:52: FreeImage version: 3.15.1
16:57:52: This program uses FreeImage, a free, open source image library supporting all common bitmap formats. See http://freeimage.sourceforge.net for details
16:57:52: Supported formats: bmp,ico,jpg,jif,jpeg,jpe,jng,koa,iff,lbm,mng,pbm,pbm,pcd,pcx,pgm,pgm,png,ppm,ppm,ras,tga,targa,tif,tiff,wap,wbmp,wbm,psd,cut,xbm,xpm,gif,hdr,g3,sgi,exr,j2k,j2c,jp2,pfm,pct,pict,pic,3fr,arw,bay,bmq,cap,cine,cr2,crw,cs1,dc2,dcr,drf,dsc,dng,erf,fff,ia,iiq,k25,kc2,kdc,mdc,mef,mos,mrw,nef,nrw,orf,pef,ptx,pxn,qtk,raf,raw,rdc,rw2,rwl,rwz,sr2,srf,sti
16:57:52: Registering ResourceManager for type HighLevelGpuProgram
16:57:52: Registering ResourceManager for type Compositor
16:57:52: MovableObjectFactory for type 'Entity' registered.
16:57:52: MovableObjectFactory for type 'Light' registered.
16:57:52: MovableObjectFactory for type 'BillboardSet' registered.
16:57:52: MovableObjectFactory for type 'ManualObject' registered.
16:57:52: MovableObjectFactory for type 'BillboardChain' registered.
16:57:52: MovableObjectFactory for type 'RibbonTrail' registered.
16:57:52: Loading library .\RenderSystem_Direct3D9
16:57:52: Installing plugin: D3D9 RenderSystem
16:57:52: D3D9 : Direct3D9 Rendering Subsystem created.
16:57:52: D3D9: Driver Detection Starts
16:57:52: D3D9: Driver Detection Ends
16:57:52: Plugin successfully installed
16:57:52: Loading library .\RenderSystem_GL
16:57:52: Installing plugin: GL RenderSystem
16:57:52: OpenGL Rendering Subsystem created.
16:57:52: Plugin successfully installed
16:57:52: *-*-* OGRE Initialising
16:57:52: *-*-* Version 1.7.4 (Cthugha)
16:57:52: Added resource location 'media/materials/scripts' of type 'FileSystem' to resource group 'General'
16:57:52: Added resource location 'media/materials/textures' of type 'FileSystem' to resource group 'General'
16:57:52: Added resource location 'media/materials/textures/nvidia' of type 'FileSystem' to resource group 'General'
16:57:52: Added resource location 'media/models' of type 'FileSystem' to resource group 'General'
16:57:52: OGRE EXCEPTION(6:FileNotFoundException): 'ogre.cfg' file not found! in ConfigFile::load at ..\..\..\..\OgreMain\src\OgreConfigFile.cpp (line 83)
16:57:52: OGRE EXCEPTION(6:FileNotFoundException): 'ogre.cfg' file not found! in ConfigFile::load at ..\..\..\..\OgreMain\src\OgreConfigFile.cpp (line 83)
16:57:52: OGRE EXCEPTION(6:FileNotFoundException): 'ogre.cfg' file not found! in ConfigFile::load at ..\..\..\..\OgreMain\src\OgreConfigFile.cpp (line 83)
16:58:04: CPU Identifier & Features
16:58:04: -------------------------
16:58:04:  *   CPU ID: AuthenticAMD: AMD Athlon(tm) 64 X2 Dual Core Processor 6000+
16:58:04:  *      SSE: yes
16:58:04:  *     SSE2: yes
16:58:04:  *     SSE3: yes
16:58:04:  *      MMX: yes
16:58:04:  *   MMXEXT: yes
16:58:04:  *    3DNOW: yes
16:58:04:  * 3DNOWEXT: yes
16:58:04:  *     CMOV: yes
16:58:04:  *      TSC: yes
16:58:04:  *      FPU: yes
16:58:04:  *      PRO: yes
16:58:04:  *       HT: no
16:58:04: -------------------------
16:58:04: *** Starting Win32GL Subsystem ***
16:58:04: Parsing scripts for resource group Autodetect
16:58:04: Finished parsing scripts for resource group Autodetect
16:58:04: Parsing scripts for resource group General
16:58:04: Parsing script AxisMaterial.material
16:58:04: Parsing script Examples.material


DX

17:00:31: Creating resource group General
17:00:31: Creating resource group Internal
17:00:31: Creating resource group Autodetect
17:00:31: SceneManagerFactory for type 'DefaultSceneManager' registered.
17:00:31: Registering ResourceManager for type Material
17:00:31: Registering ResourceManager for type Mesh
17:00:31: Registering ResourceManager for type Skeleton
17:00:31: MovableObjectFactory for type 'ParticleSystem' registered.
17:00:31: OverlayElementFactory for type Panel registered.
17:00:31: OverlayElementFactory for type BorderPanel registered.
17:00:31: OverlayElementFactory for type TextArea registered.
17:00:31: Registering ResourceManager for type Font
17:00:31: ArchiveFactory for archive type FileSystem registered.
17:00:31: ArchiveFactory for archive type Zip registered.
17:00:31: DDS codec registering
17:00:31: FreeImage version: 3.15.1
17:00:31: This program uses FreeImage, a free, open source image library supporting all common bitmap formats. See http://freeimage.sourceforge.net for details
17:00:31: Supported formats: bmp,ico,jpg,jif,jpeg,jpe,jng,koa,iff,lbm,mng,pbm,pbm,pcd,pcx,pgm,pgm,png,ppm,ppm,ras,tga,targa,tif,tiff,wap,wbmp,wbm,psd,cut,xbm,xpm,gif,hdr,g3,sgi,exr,j2k,j2c,jp2,pfm,pct,pict,pic,3fr,arw,bay,bmq,cap,cine,cr2,crw,cs1,dc2,dcr,drf,dsc,dng,erf,fff,ia,iiq,k25,kc2,kdc,mdc,mef,mos,mrw,nef,nrw,orf,pef,ptx,pxn,qtk,raf,raw,rdc,rw2,rwl,rwz,sr2,srf,sti
17:00:31: Registering ResourceManager for type HighLevelGpuProgram
17:00:31: Registering ResourceManager for type Compositor
17:00:31: MovableObjectFactory for type 'Entity' registered.
17:00:31: MovableObjectFactory for type 'Light' registered.
17:00:31: MovableObjectFactory for type 'BillboardSet' registered.
17:00:31: MovableObjectFactory for type 'ManualObject' registered.
17:00:31: MovableObjectFactory for type 'BillboardChain' registered.
17:00:31: MovableObjectFactory for type 'RibbonTrail' registered.
17:00:31: Loading library .\RenderSystem_Direct3D9
17:00:31: Installing plugin: D3D9 RenderSystem
17:00:31: D3D9 : Direct3D9 Rendering Subsystem created.
17:00:31: D3D9: Driver Detection Starts
17:00:31: D3D9: Driver Detection Ends
17:00:32: Plugin successfully installed
17:00:32: Loading library .\RenderSystem_GL
17:00:32: Installing plugin: GL RenderSystem
17:00:32: OpenGL Rendering Subsystem created.
17:00:32: Plugin successfully installed
17:00:32: *-*-* OGRE Initialising
17:00:32: *-*-* Version 1.7.4 (Cthugha)
17:00:32: Added resource location 'media/materials/scripts' of type 'FileSystem' to resource group 'General'
17:00:32: Added resource location 'media/materials/textures' of type 'FileSystem' to resource group 'General'
17:00:32: Added resource location 'media/materials/textures/nvidia' of type 'FileSystem' to resource group 'General'
17:00:32: Added resource location 'media/models' of type 'FileSystem' to resource group 'General'
17:00:32: OGRE EXCEPTION(6:FileNotFoundException): 'ogre.cfg' file not found! in ConfigFile::load at ..\..\..\..\OgreMain\src\OgreConfigFile.cpp (line 83)
17:00:32: OGRE EXCEPTION(6:FileNotFoundException): 'ogre.cfg' file not found! in ConfigFile::load at ..\..\..\..\OgreMain\src\OgreConfigFile.cpp (line 83)
17:00:32: OGRE EXCEPTION(6:FileNotFoundException): 'ogre.cfg' file not found! in ConfigFile::load at ..\..\..\..\OgreMain\src\OgreConfigFile.cpp (line 83)
17:00:35: CPU Identifier & Features
17:00:35: -------------------------
17:00:35:  *   CPU ID: AuthenticAMD: AMD Athlon(tm) 64 X2 Dual Core Processor 6000+
17:00:35:  *      SSE: yes
17:00:35:  *     SSE2: yes
17:00:35:  *     SSE3: yes
17:00:35:  *      MMX: yes
17:00:35:  *   MMXEXT: yes
17:00:35:  *    3DNOW: yes
17:00:35:  * 3DNOWEXT: yes
17:00:35:  *     CMOV: yes
17:00:35:  *      TSC: yes
17:00:35:  *      FPU: yes
17:00:35:  *      PRO: yes
17:00:35:  *       HT: no
17:00:35: -------------------------
17:00:35: D3D9 : Subsystem Initialising
17:00:35: Registering ResourceManager for type Texture
17:00:35: Registering ResourceManager for type GpuProgram
17:00:35: ***************************************
17:00:35: *** D3D9 : Subsystem Initialised OK ***
17:00:35: ***************************************
17:00:35: Parsing scripts for resource group Autodetect
17:00:35: Finished parsing scripts for resource group Autodetect
17:00:35: Parsing scripts for resource group General
17:00:35: Parsing script AxisMaterial.material
17:00:35: Parsing script Examples.material
17:00:35: Compiler error: reference to a non existing object in Examples.material(253)
17:00:35: Compiler error: reference to a non existing object in Examples.material(772)
17:00:35: Compiler error: reference to a non existing object in Examples.material(784)
17:00:35: Compiler error: reference to a non existing object in Examples.material(1281)
17:00:35: Compiler error: reference to a non existing object in Examples.material(1473)
17:00:35: Compiler error: reference to a non existing object in Examples.material(1508)
17:00:35: Compiler error: reference to a non existing object in Examples.material(1617)
17:00:35: Compiler error: reference to a non existing object in Examples.material(1622)
17:00:35: Compiler error: reference to a non existing object in Examples.material(1716)
17:00:35: Parsing script GridMaterial.material
17:00:35: Parsing script Ogre.material
17:00:35: Finished parsing scripts for resource group General
17:00:35: Parsing scripts for resource group Internal
17:00:35: Finished parsing scripts for resource group Internal
17:00:35: D3D9 : Created D3D9 Rendering Window 'Simutrans Nightly 110.0.2' : 640x480, 32bpp
17:00:35: D3D9 : WARNING - disabling VSync in windowed mode can cause timing issues at lower frame rates, turn VSync on if you observe this problem.
17:00:35: RenderSystem capabilities
17:00:35: -------------------------
17:00:35: RenderSystem Name: Direct3D9 Rendering Subsystem
17:00:35: GPU Vendor: ati
17:00:35: Device Name: Monitor-1-ATI Radeon X1200 Series (Microsoft Corporation - WDDM)
17:00:35: Driver Version: 8.14.10.630
17:00:35:  * Fixed function pipeline: yes
17:00:35:  * Hardware generation of mipmaps: yes
17:00:35:  * Texture blending: yes
17:00:35:  * Anisotropic texture filtering: yes
17:00:35:  * Dot product texture operation: yes
17:00:35:  * Cube mapping: yes
17:00:35:  * Hardware stencil buffer: yes
17:00:35:    - Stencil depth: 8
17:00:35:    - Two sided stencil support: yes
17:00:35:    - Wrap stencil values: yes
17:00:35:  * Hardware vertex / index buffers: yes
17:00:35:  * Vertex programs: yes
17:00:35:  * Number of floating-point constants for vertex programs: 256
17:00:35:  * Number of integer constants for vertex programs: 16
17:00:35:  * Number of boolean constants for vertex programs: 16
17:00:35:  * Fragment programs: yes
17:00:35:  * Number of floating-point constants for fragment programs: 32
17:00:35:  * Number of integer constants for fragment programs: 16
17:00:35:  * Number of boolean constants for fragment programs: 16
17:00:35:  * Geometry programs: no
17:00:35:  * Number of floating-point constants for geometry programs: 0
17:00:35:  * Number of integer constants for geometry programs: 3
17:00:35:  * Number of boolean constants for geometry programs: 0
17:00:35:  * Supported Shader Profiles: hlsl ps_1_1 ps_1_2 ps_1_3 ps_1_4 ps_2_0 ps_2_b ps_2_x vs_1_1 vs_2_0
17:00:35:  * Texture Compression: yes
17:00:35:    - DXT: yes
17:00:35:    - VTC: no
17:00:35:    - PVRTC: no
17:00:35:  * Scissor Rectangle: yes
17:00:35:  * Hardware Occlusion Query: yes
17:00:35:  * User clip planes: yes
17:00:35:  * VET_UBYTE4 vertex element type: yes
17:00:35:  * Infinite far plane projection: yes
17:00:35:  * Hardware render-to-texture: yes
17:00:35:  * Floating point textures: yes
17:00:35:  * Non-power-of-two textures: yes (limited)
17:00:35:  * Volume textures: yes
17:00:35:  * Multiple Render Targets: 4
17:00:35:    - With different bit depths: no
17:00:35:  * Point Sprites: yes
17:00:35:  * Extended point parameters: yes
17:00:35:  * Max Point Size: 10
17:00:35:  * Vertex texture fetch: no
17:00:35:  * Number of world matrices: 0
17:00:35:  * Number of texture units: 8
17:00:35:  * Stencil buffer depth: 8
17:00:35:  * Number of vertex blend matrices: 0
17:00:35:  * Render to Vertex Buffer : no
17:00:35:  * DirectX per stage constants: no
17:00:35: DefaultWorkQueue('Root') initialising on thread 00321350.
17:00:35: Particle Renderer Type 'billboard' registered
17:00:35: DefaultWorkQueue('Root')::WorkerFunc - thread 00341168 starting.
17:00:35: DefaultWorkQueue('Root')::WorkerFunc - thread 00341138 starting.
17:00:35: Mesh: Loading ogrehead.mesh.
17:00:35: Texture: GreenSkin.jpg: Loading 1 faces(PF_R8G8B8,256x256x1) with  hardware generated mipmaps from Image. Internal format is PF_X8R8G8B8,256x256x1.
17:00:35: Texture: spheremap.png: Loading 1 faces(PF_R8G8B8,256x256x1) with  hardware generated mipmaps from Image. Internal format is PF_X8R8G8B8,256x256x1.
17:00:35: D3D9 : ***** Dimensions altered by the render system
17:00:35: D3D9 : ***** Source image dimensions : 96x96
17:00:35: D3D9 : ***** Texture dimensions : 128x128
17:00:35: Texture: tusk.jpg: Loading 1 faces(PF_R8G8B8,96x96x1) with 7 generated mipmaps from Image. Internal format is PF_X8R8G8B8,128x128x1.
17:00:35: D3D9 : ***** Dimensions altered by the render system
17:00:35: D3D9 : ***** Source image dimensions : 640x480
17:00:35: D3D9 : ***** Texture dimensions : 1024x512
17:00:35: D3D9 : ***** Dimensions altered by the render system
17:00:35: D3D9 : ***** Source image dimensions : 640x480
17:00:35: D3D9 : ***** Texture dimensions : 1024x512
17:00:35: *** Initializing OIS ***
17:00:35: Texture: entis.png: Loading 1 faces(PF_A8R8G8B8,32x32x1) with  hardware generated mipmaps from Image. Internal format is PF_A8R8G8B8,32x32x1.

Markohs


Ters

I get the same result as prissi, though I can see the Simutrans logo with an Ogre head in the violet. Both look OK. I also have an ATI card, but an ATI Mobility Radeon HD 5850.

VS

Are you using textures that are not 2^n -sized? That doesn't work everywhere...

My projects... Tools for messing with Simutrans graphics. Graphic archive - templates and some other stuff for painters. Development logs for most recent information on what is going on. And of course pak128!

Markohs

Just one question @prissi or someone that knows about this, I was trying to understand this macro in simgraph.h


#define display_set_image_proc( is_global ) \
{ \
    if(  is_global  ) { \
        display_normal = display_img_aux; \
        display_color = display_color_img; \
        display_blend = display_rezoomed_img_blend; \
        current_tile_raster_width = get_tile_raster_width(); \
    } \
    else { \
        display_normal = display_base_img; \
        display_color = display_base_img; \
        display_blend = display_base_img_blend; \
        current_tile_raster_width = get_base_tile_raster_width(); \
    } \
}


As I see it changes the drawing functions, it's used on 2 places of the code:

karte_ansicht_t::display in simview.cc, before drawing the "world" and in gui_world_view_t.cc :


void world_view_t::internal_draw(const koord offset, ding_t const* const ding)
{
    display_set_image_proc(false);
...


I inserted a breakpoint in that line and it only triggered when I opened the finances window, not the world map as the name suggested. Can't really understand this mechanism, why does only the finances window need different drawing routines?

Thank you!

Markohs

#302
@VS, yes, using non power of 2 textures on the code, but I think that's not the issue because it worked on jamesonpetts computer on the first version (it was already a non power of 2 texture). I'm a bit clueless now why isn't working at prissi,james and Ters computer while it works in my 2 computers, and the logs don't show anything. prissi's log also shows it supports non power of 2 texures.

If that ends being the issue, I might need to use a high resolution texture and let the renderer scale it back each frame (this is suposed to be done by the HW)

if music starts to play and the whole screen is violet that means the 2 overlays are not being blended with the background, the reason might be many, from the blending code not being supported by that driver (it should show in the log or simulated in software by Ogre), to the textures not being assigned correctly (I think that's the issue, even through it's strange because prissi sees the pak selection screen).

The structure is:

- A normal camera focusing a empty(violet) scene
- On top of it, a overlay with a material applied, filling whole screen. The material is composed of (from back to front):
   * A A1R5G5B5 texture, sized to the same dimensions of screen. All simgraph routines write there. it's named "tex".
   * A A1R5G5B5 texure,  sized to the same dimensions of screen. It's a RTT (render-to-target) texture, a scene it's rendered to it each frame, it's background is transparent. It's named "rtt_texture".

The material is blended with the scene, and the blending between layers is:

The alpha of the resulting blending is the sum(Ogre::LBX_ADD):

transparent=0, non_transparent=1 => transparent+transparent = 0; transparent+non_transparent = 1; non_transparent+transparent = 1; non_transparent+non_transparent=1

The color values are just interpolated (Ogre::LBX_BLEND_TEXTURE_ALPHA,Ogre::LBO_ALPHA_BLEND)


      matPass->setSceneBlending(Ogre::SBT_TRANSPARENT_ALPHA );

      pTexState1 = matPass->createTextureUnitState( tex->getName() );
      pTexState2 = matPass->createTextureUnitState( rtt_texture->getName() );

      pTexState1->setTextureAddressingMode(Ogre::TextureUnitState::TAM_CLAMP);
      pTexState1->setColourOperation(Ogre::LBO_ALPHA_BLEND);

      pTexState2->setTextureAddressingMode(Ogre::TextureUnitState::TAM_CLAMP);
      pTexState2->setColourOperationEx(Ogre::LBX_BLEND_TEXTURE_ALPHA ,Ogre::LBS_TEXTURE,Ogre::LBS_CURRENT);
      pTexState2->setAlphaOperation(Ogre::LBX_ADD,Ogre::LBS_TEXTURE,Ogre::LBS_CURRENT,1.0);

VS

My information might not be up to date, but support for non-2^n (aka NPOT) textures depends on actual hardware and maybe driver as well. I wouldn't rule this out...

My projects... Tools for messing with Simutrans graphics. Graphic archive - templates and some other stuff for painters. Development logs for most recent information on what is going on. And of course pak128!

Ters

I would be really disappointed if my graphics "card" and driver was so low end that it didn't support NPOT textures. I'm pretty sure support for that started appearing a decade ago (or maybe more, time flies) in consumer hardware, and my computer is less than a year old. I'll see if I can look into it a bit myself this weekend.

Dwachs

Quote from: Markohs on January 26, 2012, 05:16:31 PM
Just one question @prissi or someone that knows about this, I was trying to understand this macro in simgraph.h

#define display_set_image_proc( is_global ) \
{...
  } \
}

iirc, this method changes the way images are drawn: to show unzoomed (base) images or zoomed images.
This is set when the gui needs to show images of in-game objects. This way, the unzoomed images are shown in the gui, while the world view may be zoomed out/in. Before this change, the images of vehicles in depot window etc were zoomed as soon as the world view zoomed.

Finance window calls it to show image of headquarter location unzoomed. Any information window for houses, factories etc should also have call to this macro.
Parsley, sage, rosemary, and maggikraut.

Markohs

Thank you, I noticed it gets called on clicking on a vehicle too, the mini-screen that follows the vehicle.

isidoro

Maybe a small OT, but I seem to have noticed, while playing, that that small window is drawn differently from world view.  Some graphic overlapping, specially at covered bridges happens there and not in the world.  Is that true?


Markohs

yeah, I think I noticed it too while playing. I think it's directly related to this 2 modes of drawing, but don't really know yet.

Dwachs

Quote from: isidoro on January 27, 2012, 12:29:56 PM
Maybe a small OT, but I seem to have noticed, while playing, that that small window is drawn differently from world view.  Some graphic overlapping, specially at covered bridges happens there and not in the world.  Is that true?
Yes thats true. It would require to adapt the not-so-new drawing method also in info windows. There the 'old' method is still used. This gives the ability to compare with the good old days....
Parsley, sage, rosemary, and maggikraut.

Markohs

#310
Just a screenshot of the program now, I replaced the ogre model with an export of Almuthof Station.blend I found somewere time ago. It's not aligned with the grid, yet, working on it. :)

This will be a productive weekend I hope. :)

I got the station, on one mesh, ready to be exported in:

http://dl.dropbox.com/u/30024783/Almuthof%20Station.blend


missingpiece

I love screenshots of WIP.  8)

Markohs

Not all Screenshots of WIP are so cool :)


Zeno

Well, not so cool, but keeps being really promising :)

Ters

I managed to get simutrans3d to compile with mingw after doing a few changes. I've attached a patch for some of the changes, that doesn't seem like correct C++ to me. I also had to comment out line 48 in sim32map.cc, but that may be because something is missing in svn.
The executable I compiled also crashes. The debugger tells me that this is because dr_query_screen_resolution() queries renderWindow, that is NULL. dr_query_screen_resolution() is called from line 679 in simmain.cc, but as far as I can tell, renderWindow isn't initialized until dr_os_open() is called, which first happens when simgraph_init() is called at line 691 in simmain.cc.
I check out revision 5138. Is that revision supposed to work?