• Hey Guest! Ever feel like entering a Game Jam, but the time limit is always too much pressure? We get it... You lead a hectic life and dedicating 3 whole days to make a game just doesn't work for you! So, why not enter the GMC SLOW JAM? Take your time! Kick back and make your game over 4 months! Interested? Then just click here!

3D 3D Texture Turns Black When Stretched

Posho

Member
Hello, I have this issue. I'm working on a function that basically draws SWF sprites on a surface and saves them as regular sprites to use them as 3D textures for walls and stuff. I started implementing an user-set quality variable, which basically helps with setting the new sprites' size.

qual = 2 -> 1024x1024 texture
qual = 1 -> 512x512 texture (original SWF size)
qual = 0.5 -> 256x256 texture
qual = 0.25 -> 128x128 texture
etc.

The thing is that when qual is somewhere between 0 and 1 the outcome works as expected, however when qual is bigger than 1 it starts darkening the texture until 2 when it becomes pitch-black.

qual = 0.5 -> right color
qual = 1 -> right color
qual = 1.5 -> darker color
qual = 2 -> pitch-black

Take a look at the code if you want. As you can see I set the Draw color to c_white before drawing and the original textures' sizes are all a power of 2, so I don't know what the issue would be.
Code:
draw_enable_swf_aa(true);
draw_set_swf_aa_level(1);
draw_set_color(c_white)

qual = 2

surf = surface_create(sprite_get_width(argument0)*qual,sprite_get_height(argument0)*qual)
surface_set_target(surf)
draw_clear_alpha(make_colour_hsv(0,0,10), false);
draw_sprite_stretched(argument0, 0, 0, 0, sprite_get_width(argument0)*qual, sprite_get_height(argument0)*qual)
surface_reset_target();
spr = sprite_create_from_surface(surf,0,0,sprite_get_width(argument0)*qual,sprite_get_height(argument0)*qual,argument1,true,(sprite_get_width(argument0)*qual)/2,sprite_get_height(argument0)*qual)
surface_free(surf)

Any ideas? I've been days stuck on this thing. :rolleyes:
 

Posho

Member
I am not entirely sure how you are drawing the sprite-- but I have had issues before with 3D and custom textures:
http://gmc.yoyogames.com/index.php?showtopic=682141&hl=djk164#entry4905798
and my bug report: http://bugs.yoyogames.com/view.php?id=19905

I am not entirely sure if it is related, but it might be something worth looking into
I actually figured it out. Everything worked fine after shutting down the fog entirely.
There is something about the way I set fog that disturbs that projection specifically. The ordering, perhaps?
 

Posho

Member
Do you have draw_set_colour(c_white) in the draw event of the object you want to strech?
If not, this is your problem!
Put this code in the draw event of the object to fix this, but if it dosn't work...
Ya...
Yes, I did. It's explained on the opening post.
I already fixed it, the issue was the fog.
 
Top