Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WIP: quick parallax for real time lights #193

Open
wants to merge 1 commit into
base: master
from

Conversation

Projects
None yet
2 participants
@illwieckz
Copy link
Member

illwieckz commented Mar 26, 2019

It jumps from 31fps to 95fps on hd1080p (110fps in a common scene) on an R9 390X with flame thrower on an open scene that is known to be far slower than the average, I don't see anything wrong noticeable.

Produces 65fps on 2K on that costly scene (90fps in a common scene) and 36fps on 4K (45fps in common scene).

Note that without flame thrower, I get 200~225fps (hd1080p), 185/225fps (2K), 100/140fps (4K).

Basically this quick parallax is only done to be sure the realtime light is not shifted from the usual lightmapped scene (which is parallaxed with a more efficient algorithm).

I'll post screenshots later.

This hack makes a Dæmon based game performant enough to be releasable with parallax enabled or at least available to the user.

@illwieckz illwieckz force-pushed the illwieckz:quickparallax branch from ef99560 to fdb55de Mar 26, 2019

@illwieckz

This comment has been minimized.

Copy link
Member Author

illwieckz commented Mar 26, 2019

This is an Unvanquished map layout for the Xonotic solarium map:

arm -2250.734375 -1314.114990 -116.574997 0.000000 -155.000000 0.000000 0.000000 0.000000 1.000000 0.000000 0.000000 0.000000
reactor -2251.954590 -1416.356567 -123.875000 0.000000 -97.000000 0.000000 0.000000 0.000000 1.000000 0.000000 0.000000 0.000000
overmind -1768.764893 373.085999 -112.875000 0.000000 -93.000000 0.000000 0.000000 0.000000 1.000000 0.000000 0.000000 0.000000
telenode -2204.000000 -980.000000 -91.875000 0.000000 0.000000 0.000000 0.000000 0.000000 1.000000 0.000000 0.000000 0.000000
medistat -2249.424316 -1235.030640 -127.875000 0.000000 -90.000000 0.000000 0.000000 0.000000 1.000000 0.000000 0.000000 0.000000
eggpod -1905.912476 268.833099 -80.875000 0.000000 137.000000 0.000000 0.000000 0.000000 1.000000 0.000000 0.000000 0.000000

put it in ~/.local/share/unvanquished/game/layouts/solarium/base.dat and load the map this way: devmap solarium base.

This makes testing flame-thrower in a parallax enabled map easy.

@slipher

This comment has been minimized.

Copy link
Contributor

slipher commented Mar 26, 2019

This may be a dumb idea, but I wonder if it's possible to do something like batching several lights together so that the parallax calculation doesn't have to be redone for every light.

@illwieckz

This comment has been minimized.

Copy link
Member Author

illwieckz commented Mar 30, 2019

or to do the parallax compute for the given pixel one time whatever the lighting…

@illwieckz

This comment has been minimized.

Copy link
Member Author

illwieckz commented Mar 30, 2019

@gimhael or @cmf028 do you know if there is a way to compute the texOffset one time per pixel per frame then to store it so other shaders may use it? for example abusing a texture that would not be displayed?

@illwieckz

This comment has been minimized.

Copy link
Member Author

illwieckz commented Mar 30, 2019

Basically uploading two times the texture if it's a diffuse one and r_parallaxMapping is enabled, compute offset and store the texOffset in r and g (x and y) in an early stage, then bind the given map in stages that would need it…

@illwieckz illwieckz force-pushed the illwieckz:quickparallax branch from fdb55de to 141dc23 Mar 31, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.