FastDoom icon indicating copy to clipboard operation
FastDoom copied to clipboard

The first pixel of a flat is not very representative

Open RamonUnch opened this issue 4 years ago • 3 comments
trafficstars

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

RamonUnch avatar Mar 07 '21 08:03 RamonUnch

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

AXDOOMER avatar Mar 07 '21 22:03 AXDOOMER

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 !!

viti95 avatar Mar 07 '21 22:03 viti95

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).

RamonUnch avatar Mar 08 '21 08:03 RamonUnch