Is there a way to create plasma effects in SFML that does not slow down my framerate crawl?
1) Manipulate the image bits in the form of a byte directly (or int / whatever is based on your target color depth)
. Do not use GetsPixel () with any picture every time.
2) Minimize your math You will usually use many triangular functions for plasma effects, which is very slow by you (height width framate) times per second Are in motion. Either use a fast dedicated mathematical library for your calocations or, better yet, cache calculations at the beginning and use a glance-up table during the effect of completely cutting the math of each frame.
3) One of the things that used to run the old school's plasma effect so fast. Palette cycling is not known to repeat this (or bandages in general) with SFML in any way , But you can use GLSL shaders to get similar results without large performance hits. Something like this:
float4 PS_ ColorShift (float2 Tex: TEXCOORD0): COLOR0 {float4 color = tex2D (colorMap, Tex); Color.r = color.r + sin (colorshift_timer + 0.01f); Color.g = color.g + sin (colorshift_timer + 0.02f); Color.b = color.b + sin (colorshift_timer + 0.03f); Color.a = 1.0f; (Color) perfect; The color of the return; }
Comments
Post a Comment