gongpha / gdQmapbsp

A simple plugin that loads Quake's MAP/BSP files into Godot 4 interactively
MIT License
42 stars 5 forks source link

Shader problems with newly animated textures code merge #23

Closed victorbstan closed 11 months ago

victorbstan commented 11 months ago

Of course it can't "just workTM", :(

Screenshot 2023-07-17 at 5 31 45 PM
victorbstan commented 11 months ago

I have managed to get it to work, to show fullbrights, and animated textures, but yes, we are hitting those limits again, I found that to make it work I have to change const GLOBAL_TEXTURE_LIMIT := 48 (92/2) and change the shader code to use 48

uniform sampler2D[48] texs : source_color; // device dependent
uniform sampler2D[48] texfs : source_color; // device dependent

And even so, it depends on the map, at such low textures limits it's bound to ruin texturing on some surfaces. But yeah, it seems those numbers are a real limit at least on my video card, probably others :(

victorbstan commented 11 months ago

The good news is, once we figure out a workaround for not storing an array of textures in shader code, it should "Just WorkTM" :)

victorbstan commented 11 months ago

I'm not very versed in shader or graphics programming but could the storage of textures be implemented in GDScript, for example the two arrays that hold textures var texs = [], var texsf = [] and in shader code uniform sampler2D texs and have the logic be applied on the GDScript variable and then have that set the value on the shader property? I'm probably talking out of my ass now TBH...

gongpha commented 11 months ago

Sounds very terrible that the vulkan support in MacOS is pretty limited actually . . .

The reason I used the sample array was that I could use a single material across the entire map. which may increase efficiency. However, if it's in exchange for making it hard for users to customize or having problems like yours. I should try to deal with it . . .