Rpg maker vx ace lighting effects4/27/2024 ![]() ![]() If (flame_light_state > limit_flame_effect) ImageView::get_instance()->blend_images(dark_effect_light_source_mask, dark_effect_surface, player_center_pos.x-dark_effect_light_source_mask.surface->w/2, player_center_pos.y-dark_effect_light_source_mask.surface->h/2) ImageView::get_instance()->blend_images(dark_effect_light_source_mask, dark_effect_surface, player_center_pos.x-512, player_center_pos.y-512) ImageView::get_instance()->blend_images(alpha_mask_dark_effect, dark_effect_surface, 0, 0) St_position player_center_pos = GameManager::get_instance()->get_player_relative_center_position() SDL_SetTextureBlendMode(dark_effect_surface.texture, SDL_BLENDMODE_MOD) SDL_SetTextureBlendMode(dark_effect_surface.texture, SDL_BLENDMODE_BLEND) ImageView::get_instance()->init_target_image(alpha_mask_dark_effect, RES_W, AREA_H) It’s been a while, so I do not recall 100% what I did, but the code, not all direct SDL calls and including some animation in the light sources circle size, so it trembles a bit, but fairly easy to understand, is as follows: st_imageData alpha_mask_dark_effect Yes, I did manage to get it working as I wanted after a while, with transparent darkness including blue hue, and lightsource for the player and others that blend with it. ![]() Oh, I totally forgot to update this thread, sorry. I have played with different options of blending and creating custom blendmode with all the possible combinations I could come up. SDL_RenderCopy(renderer, resultLayer, NULL, &gameRect) SDL_RenderCopy(renderer, lightLayer, NULL, &gameRect) SDL_RenderCopy(renderer, backgroundLayer, NULL, &gameRect) SDL_SetTextureBlendMode(resultLayer, SDL_BLENDMODE_BLEND) SDL_SetRenderTarget(renderer, resultLayer) SDL_RenderCopy(renderer, lightTexture, NULL, &spot2) SDL_RenderCopy(renderer, lightTexture, NULL, &spot1) SDL_SetRenderDrawColor(renderer, 0x36, 0x45, 0x9b, 0xff) change the black color to a more transparent one SDL_SetTextureBlendMode(lightLayer, SDL_BLENDMODE_MOD) SDL_SetRenderTarget(renderer, lightLayer) SDL_RenderCopy(renderer, bgTexture, NULL, &gameRect) SDL_SetRenderTarget( renderer, backgroundLayer ) fake game tiles, objects, players rendering SDL_Texture * lightTexture = SDL_CreateTextureFromSurface(renderer, lightSurface) SDL_Surface * lightSurface = IMG_Load("spot.jpg") SDL_Texture * bgTexture = SDL_CreateTextureFromSurface(renderer, bgSurface) SDL_Surface * bgSurface = IMG_Load("game.jpg") SDL_Texture * resultLayer = SDL_CreateTexture(renderer, SDL_PIXELFORMAT_RGBA8888, SDL_TEXTUREACCESS_TARGET, 640, 480) SDL_Texture * lightLayer = SDL_CreateTexture(renderer, SDL_PIXELFORMAT_RGBA8888, SDL_TEXTUREACCESS_TARGET, 640, 480) SDL_Texture * backgroundLayer = SDL_CreateTexture(renderer, SDL_PIXELFORMAT_RGBA8888, SDL_TEXTUREACCESS_TARGET, 640, 480) SDL_SetRenderDrawBlendMode(renderer, SDL_BLENDMODE_BLEND) SDL_Renderer * renderer = SDL_CreateRenderer(window, -1, SDL_RENDERER_PRESENTVSYNC) Is possible to do all this to create ambient light? #include Or How do I create a tint in the light black color that blends to the game background to look like tint? How I blend another color or tint a texture to look like the screenshot of pokemon or the last game linked to gamasutra? How do I change the black color to be transparent while having the “bright” spot? ![]()
0 Comments
Leave a Reply.AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |