SM3 - Page 3

SM3

Discuss the source code and development of Spring Engine in general from a technical point of view. Patches go here too.

Moderator: Moderators

Post Reply
User avatar
Beherith
Posts: 5145
Joined: 26 Oct 2007, 16:21

Re: SM3

Post by Beherith »

Did you even read my post?

Yes it takes the cameras position and uses the x and z coords from it.
Yes it can be configured to use any vector, even the cameras point-at vector.

But, that isnt much more optimal than using the current X and Z of the cam pos, since now, the most detail is where the camera is closest to terrian, quite a sensible assumption, doesnt always work best.

But your proposed solution of using the point vector doesnt take into account when the cam is not pointing at the terrain, or the vector is close to parallel with the ground.

http://github.com/spring/spring/blob/42 ... Drawer.cpp

Code: Select all

 289 float cx2 = cam2->pos.x / SQUARE_SIZE;
 290 float cy2 = cam2->pos.z / SQUARE_SIZE;
This defines the point of highest lod. Change->test->enjoy!
User avatar
Argh
Posts: 10920
Joined: 21 Feb 2005, 03:38

Re: SM3

Post by Argh »

Ah. You're correct, I didn't worry about whether we were pointed at the ground at all.

I guess I assumed that if we didn't have a collision with the ground at any corner of the screen from the frustrum, we'd just not bother with a LOD at all that rendering pass.

But it's essential that we calculate the LOD based not on the X,Z of the camera, but on the nearest valid intercept. Otherwise we're generating a lot of terrain outside the frustrum at a higher LOD than it should be. Hence my complaint from the start.

That's why using the camera's position is a problem. I can see why you thought that might help a bit, but really it's not going to work correctly. 99% of the time, in a practical game, the camera's facing down. If we're in FPS mode, or if we've scrolled so that the center of the POV is no longer intercepting the ground... then we might need to get the LOD from an intercept based on one of the corners of the frustrum. Should be pretty easy to add that logic.

If no intercept-->get intercepts from camera position to worldspace based on corners of POV--> if no intercept, no LOD, if intercept, use closest distance to determine LOD.

That means up to 5 vector-interception tests with the groundplane per pass, but that's not too terrible. Especially if, as I requested, we look at not generating the vertexes every single frame, but instead space it out to 5 frames or so. This could result in a very large speed improvement for both SMF and SM3, and a considerable improvement on overall CPU load, while making it possible to finally view maps at somewhere close to perfect detail.
Last edited by Argh on 01 Jul 2009, 21:14, edited 1 time in total.
User avatar
Beherith
Posts: 5145
Joined: 26 Oct 2007, 16:21

Re: SM3

Post by Beherith »

So this is what it feels like to be Argh'd. Yall got quite some patience, devs :P
User avatar
Argh
Posts: 10920
Joined: 21 Feb 2005, 03:38

Re: SM3

Post by Argh »

Your change would result in using LODs when the camera's facing straight up.

That's why I'm saying to generate intercepts from the camera to the ground plane on all four corners, if the center doesn't result in an intercept. It's far cheaper to run the intercepts than to draw a bunch of geometry we cannot see.

At any rate, meh... improvement is improvement, and I will test it and see if it results in any practical changes.

And yes, since I know you're going to point this out, there should be an exception, if the camera is less than Y from the nearest ground.

Generate an intercept from some distance above the camera to the ground along the Z axis, and use that to generate a LOD that's mainly in front of the camera, where it belongs. That'll take care of low-flying behavior and FPS mode.
Master-Athmos
Posts: 916
Joined: 27 Jun 2009, 01:32

Re: SM3

Post by Master-Athmos »

imbaczek wrote:latest installers indeed should have that file.
Yeah the installer delivered all the files needed and yes Urban now runs fine without that flickering. However it seems the fix has broken something:

On Urban the radar has become a "transparent" box showing nothing but the icons and the outline and when pressing F2 or F4 for the respective special views I just get an entirely grey map - I'd say the map becomes invisible and you just see the distance fog. All of this works fine on Narrow Passage...
User avatar
FLOZi
MC: Legacy & Spring 1944 Developer
Posts: 6240
Joined: 29 Apr 2005, 01:14

Re: SM3

Post by FLOZi »

The transparent box is because urban does not have a minimap image, whereas NP does.
User avatar
Argh
Posts: 10920
Joined: 21 Feb 2005, 03:38

Re: SM3

Post by Argh »

Yes. Sorry, Urban was never intended to be anything but a rough technical test.
Kloot
Spring Developer
Posts: 1867
Joined: 08 Oct 2006, 16:58

Re: SM3

Post by Kloot »

Master-Athmos wrote:when pressing F2 or F4 for the respective special views I just get an entirely grey map
Should now be fixed too, that was actually an unrelated problem.
Master-Athmos
Posts: 916
Joined: 27 Jun 2009, 01:32

Re: SM3

Post by Master-Athmos »

Indeed - works just fine now. Just keep working on the other problems & shortcomings of this format to make quite some people happy... :-)
reivanen
Posts: 180
Joined: 12 Feb 2008, 15:52

Re: SM3

Post by reivanen »

sm3 should e a easy fix for modern hardware, buggy/outdated hardware cn be left with supporting hosting regular maps. sm3 has really to come, it will bring a new visual verbosity to the game and doubling framerate!

oh how i miss thos test games from some 6 months ago where metal heck ran over 100% faster and had some complere new gfx goodies on top of that...
reivanen
Posts: 180
Joined: 12 Feb 2008, 15:52

Re: SM3

Post by reivanen »

I will personally donate 20Ôé¼ by paypal for the mn making sm3 the defacto map format for spring. THIS IS A PROMISE

pm. me with the plan, and as soon i fonfirm the functionality ingame the money is yours.
User avatar
AF
AI Developer
Posts: 20687
Joined: 14 Sep 2004, 11:32

Re: SM3

Post by AF »

A cookie for whoever completes SM3, cookie delivered upon the hearing of forum rapturous applause
User avatar
Das Bruce
Posts: 3544
Joined: 23 Nov 2005, 06:16

Re: SM3

Post by Das Bruce »

I will seriously bake, ice and post a batch of Afghans for anyone seriously involved in the completion/fixing of sm3.
Kloot
Spring Developer
Posts: 1867
Joined: 08 Oct 2006, 16:58

Re: SM3

Post by Kloot »

You can start by reporting which bugs still need attention. ;)
Hoi wrote:When I terraform/fire a weapon that changes the map the area that gets hit loses its texture and the texture becomes some kind of groundscar.
Could you post a screenshot of this?
Auswaschbar
Spring Developer
Posts: 1254
Joined: 24 Jun 2007, 08:34

Re: SM3

Post by Auswaschbar »

reivanen wrote:I will personally donate 20Ôé¼ by paypal for the mn making sm3 the defacto map format for spring. THIS IS A PROMISE

pm. me with the plan, and as soon i fonfirm the functionality ingame the money is yours.
Kloot, you wil be a rich man afterwards.
Master-Athmos
Posts: 916
Joined: 27 Jun 2009, 01:32

Re: SM3

Post by Master-Athmos »

Kloot wrote:
Hoi wrote:When I terraform/fire a weapon that changes the map the area that gets hit loses its texture and the texture becomes some kind of groundscar.
Could you post a screenshot of this?
Well I found out that this only occurs when you have shadows enabled. Without shadows things are fine (except for one edge of the terraformed section still having the original ground texture but I don't know if that's a shortcoming of the gadget):

Image

With shadows on things look like this though:

Image

On the right of this picture you also see an area which I "re-flatted" so it has to be a problem with the texture and not some strange shadowing...
Auswaschbar wrote:
reivanen wrote:I will personally donate 20Ôé¼ by paypal for the mn making sm3 the defacto map format for spring. THIS IS A PROMISE

pm. me with the plan, and as soon i fonfirm the functionality ingame the money is yours.
Kloot, you wil be a rich man afterwards.
Well you can add in 20 Ôé¼ from me too once I get a paypal account up and running (wanted to buy some tutorials anyway which needed paypal)... :-)
User avatar
jK
Spring Developer
Posts: 2299
Joined: 28 Jun 2007, 07:30

Re: SM3

Post by jK »

Kloot wrote:You can start by reporting which bugs still need attention. ;)
ExtraTexture doesn't work for me, so it seems AlphaTest is enabled and it writes to the alpha channel - alphatest shouldn't be enabled during ground drawing!. Also there seems to be a backbuffer problem so I can see parts of the extratexture when I enable it, but it gets overriden when i move the camera.

Shadows doesn't work at all for me.
Kloot
Spring Developer
Posts: 1867
Joined: 08 Oct 2006, 16:58

Re: SM3

Post by Kloot »

Master-Athmos wrote: With shadows on things look like this though:

Image

On the right of this picture you also see an area which I "re-flatted" so it has to be a problem with the texture and not some strange shadowing...
Cheers, that should no longer happen for any ground decals. (If you want to test, be sure to update springcontent.sdz too.)

jK wrote:ExtraTexture doesn't work for me, so it seems AlphaTest is enabled and it writes to the alpha channel - alphatest shouldn't be enabled during ground drawing!
It isn't, nothing in the SM3 code enables alpha testing.
Also there seems to be a backbuffer problem so I can see parts of the extratexture when I enable it, but it gets overriden when i move the camera.
In current master? There was a problem with FBO binding/unbinding up until a few days ago, cannot reproduce it anymore though.
User avatar
Argh
Posts: 10920
Joined: 21 Feb 2005, 03:38

Re: SM3

Post by Argh »

I did some tests, and the shadowmap is not being built from the correct POV. This explains why it "shifts" and occasionally "floats".

See this article about how this problem can be corrected. Includes all relevant source.

http://fabiensanglard.net/shadowmapping/index.php

And I agree with the author about using FBOs, if we aren't already.
User avatar
hoijui
Former Engine Dev
Posts: 4344
Joined: 22 Sep 2007, 09:51

Re: SM3

Post by hoijui »

i am currently separating SM3 sync relevant stuff from the rest *eg only rendering relevant).
could someone please explain where the Vector3 class/struct comes from? it is used in some headers that have no #include statements, and do not define it them selfs. For example rts/Map/SM3/terrain/TerrainTexture.h.
i excluded some things already, and somewhere i also excluded something that seemed to have defined this, and now its not found anymore. also, could we no use float3 instead?
Post Reply

Return to “Engine”