SRB2 Message Board  

Go Back   SRB2 Message Board > Archived > SRB2 Forum Archives > Bug Reports (2.1.X)

 
 
Thread Tools Search this Thread
Old 07-15-2016   #1
Kaysakado
Default Skyboxes render from player's position rather than camera's

At least, that's what I think is going on here. Theoretically the cactus sector in the skybox should be lining up perfectly with the cactus in the in-game sector. And the top of the blue bricks should be flush with the bottom of the wood. With chasecam off it renders perfectly, but there are strange perspective issues in third person.
Attached Thumbnails
Click image for larger version

Name:	srb20406.gif
Views:	227
Size:	3.63 MB
ID:	8511  
Attached Files
File Type: zip skyboxtest.zip (1.8 KB, 76 views)
__________________
Join the Crashed Cafe!

Last edited by toaster; 10-29-2016 at 05:38 PM.
Kaysakado is offline  
Old 07-15-2016   #2
Monster Iestyn
Friendly Neighbour-Hood
Moderator
 
Monster Iestyn's Avatar
Default

I dunno Kays... Glancing at the source code, it looks like the skyboxes are correctly rendering from the camera's position rather than the player's in third person mode. Does the same issue occur in OpenGL by any chance? I wonder if it's just software renderer's awkward perspective quirks ruining things.

Relevant bit of code for offsetting viewx/viewy relative to skybox viewpoints for chase cam starts here in R_SkyboxFrame: https://github.com/STJr/SRB2/blob/SR.../r_main.c#L926
Monster Iestyn is offline  
Old 07-15-2016   #3
Kaysakado
Default

Hm, yeah. I can't test OpenGL on this computer so can't help there. I did confirm that the same misalignment happens using an alternate view point, which is interesting. The only thing I can find that first person is doing that the other two aren't is this right here: https://github.com/STJr/SRB2/blob/6d...in.c#L850-L854
But even then, I just tested demo playback and chasecam off is rendering correctly even in a demo.
__________________
Join the Crashed Cafe!
Kaysakado is offline  
Old 07-16-2016   #4
Kaysakado
Default

Sorry for the double post; I raised the bricks to be flush with the top of the wood as in the attached PNGs. This shows that the X and Y are aligned correctly, it's just the Z that's off. I haven't been able to compile SRB2, but is it possible that instead of this:
Code:
viewz += thiscam->z / mh->skybox_scalez;
We need this:
Code:
viewz += (thiscam->z + thiscam->height>>1) / mh->skybox_scalez;
Some relevant code in R_SetupFrame: https://github.com/STJr/SRB2/blob/6d....c#L1080-L1096

And maybe even something like this, as I've noticed that if I shift the whole map down or up by 360 (and adjust the skybox thing angle to compensate) the z perspective gets even more fucked:
Code:
viewz += (thiscam->z + thiscam->height>>1 - skyboxmo[1]->z) / mh->skybox_scalez;
(Also, two things I'm curious about: Why does the skybox view point rely on angle for both viewz AND viewangle? Is there any reason skyboxmo[0]->z couldn't be used for viewz?
And is there a reason in R_SetupFrame that alt view uses 20*FRACUNIT when thiscam->height>>1 works out to 8*FRACUNIT for an unscaled chasecam?)

EDIT: I'm almost definitely sure the problem is not accounting for the camera height. In the attached GIF I raised the in-level sectors by 8 fracunits and the chasecam renders "correctly" (even though it shouldn't in this case). When I change scale, the new camera height isn't accounted for so the skybox viewz is too low! Not pictured: in first person, as you'd expect, the skybox viewz is "too high" and the skybox renders lower than the map (which is what should happen in this case).
Attached Thumbnails
Click image for larger version

Name:	srb20006.png
Views:	127
Size:	16.1 KB
ID:	8514   Click image for larger version

Name:	srb20007.png
Views:	120
Size:	20.7 KB
ID:	8515   Click image for larger version

Name:	srb20408.gif
Views:	136
Size:	379.6 KB
ID:	8516  
__________________
Join the Crashed Cafe!

Last edited by Kaysakado; 07-16-2016 at 01:20 PM.
Kaysakado is offline  
Old 07-16-2016   #5
Monster Iestyn
Friendly Neighbour-Hood
Moderator
 
Monster Iestyn's Avatar
Default

Well now, that's interesting, I'll look into testing what happens if I add those missing height offsets for chasecam/awayviewmobj viewz to R_SkyboxFrame...

As for why thing z apparently affects the z position AND angle... I'm not sure, I think there was some sort of reasoning for using angle for z along the lines of being able to be positioned below the ground? I honestly have no idea though, it didn't make a lot of sense to me either at the time I found that fact out myself.

The differences in height offset for chasecam and alt view I can't answer at all, I know nothing as to why they do that. =V

Last edited by Monster Iestyn; 07-16-2016 at 01:57 PM.
Monster Iestyn is offline  
Old 09-19-2016   #6
Monster Iestyn
Friendly Neighbour-Hood
Moderator
 
Monster Iestyn's Avatar
Default

Whoops, forgot to mention 2 months ago that I made a fix for this, which was later merged and should now be included with 2.1.16. Does the issue still occur now?
Monster Iestyn is offline  
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 03:01 PM.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2017, vBulletin Solutions, Inc.