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

The first pixel of a flat is not very representative #25

Open
RamonUnch opened this issue Mar 7, 2021 · 3 comments
Open

The first pixel of a flat is not very representative #25

RamonUnch opened this issue Mar 7, 2021 · 3 comments
Labels
enhancement New feature or request

Comments

@RamonUnch
Copy link
Contributor

I was playing with -flatsurfaces and I realized that teleporters pads were brown and not red.
From reading the source it seems that the R_DrawPlanesFlatSurfaces*() procs use the first pixel of the flat as well as the R_DrawSpanFlat function.
I tried with an offet somewhere in the middle of 4096 ie:1993 and I think it gives beter results, see below.
Maybe someone would like to look through all the flats in doom and decide which is the best offset to have the most representative color out of each flat.
Original FDoom flat reference offset = 0
FDoom_flat_index0

Flat reference offset = 1993
FDoom_flat_index1993

@viti95 viti95 added the enhancement New feature or request label Mar 7, 2021
@AXDOOMER
Copy link
Contributor

AXDOOMER commented Mar 7, 2021

Doing an average of all the pixels on the flat texture could be a better idea.

@viti95
Copy link
Owner

viti95 commented Mar 7, 2021

You're right @AXDOOMER (for example OptiDoom uses this idea), but for now it's a good compromise between speed and visual quality. I've tested different values and for now 1850 makes it even better. Thank's @RamonUnch !!

@RamonUnch
Copy link
Contributor Author

RamonUnch commented Mar 8, 2021

I will try again with 1850. I was also thinking to make the average color but it would be time consuming. the ideal solution would be to precalculate a mapping table flat<->color and load it with fdoom. this table could be even fine-tuned by hand to give the best results.
EDIT: Actually using a small table that contains just a color by flat would be helpful on RAM usage, because for now the whole falt is loaded (4096b) just for 1 color (1b).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants