Jump to content

Recommended Posts

  • 2 weeks later...
  • 2 weeks later...

Implemented multithreaded shadow map generation. The entire render process was single-threaded, now shadow map generation uses D3D11 multithreading (command lists). To test it, I used the same scenario I have been using, but now there are 4 lights generating shadows (white directional light, red point light, green spotlight and a blue spotlight). This setup uses all available shadow mapping capacity (4 shadow maps for directional/sun light and 8 shadow maps for point/spot lights).

The single-threaded method renders the scene in 13ms, while the multithreaded method renders in 8ms. That is a substantial improvement.

The drawback of D3D11 multithreading is that only nvidia supports it (as far as I know), so other hardware may not benefit as much.

spacer.png

spacer.png

  • Metin2 Dev 6
  • muscle 2
  • Love 4
On 5/24/2024 at 6:37 PM, TheEqualizer said:

Implemented multithreaded shadow map generation. The entire render process was single-threaded, now shadow map generation uses D3D11 multithreading (command lists). To test it, I used the same scenario I have been using, but now there are 4 lights generating shadows (white directional light, red point light, green spotlight and a blue spotlight). This setup uses all available shadow mapping capacity (4 shadow maps for directional/sun light and 8 shadow maps for point/spot lights).

The single-threaded method renders the scene in 13ms, while the multithreaded method renders in 8ms. That is a substantial improvement.

The drawback of D3D11 multithreading is that only nvidia supports it (as far as I know), so other hardware may not benefit as much.

spacer.png

spacer.png

Wow that is some cool Stuff

  • 1 month later...

Implemented screen space reflections.The technique is not complex but has many limitations and is probably best for subtle reflections (like rough surfaces). The game, unfortunately, does not contain any data for reflections, so I had to manually hardcode them to show reflections. The reflections on the terrain would look better with normal maps and that would also help hide SSR artifacts (this game does not have normal maps, I could generate them procedurally, from RGB data, but that tends not to work for certain types of terrain and can look really bad, so I chose not to do it).

On modern games SSR is not used alone (as I did here), it's often used along with other techniques (like static cube maps).

spacer.png

spacer.png

spacer.png

 

With SSR, it's possible to generate reflections for arbitrary surfaces (you can see the reflection of the sky and character on the sword).

spacer.png

  • Cry 1
  • Scream 3
  • muscle 1
  • Love 4

As I said, the game does not contain data for reflective materials, so I just hardcoded it to demonstrate the effect. It's not the renderer's responsibility to specify which materials are reflective.

The idea was to show that if a surface material does specify that it is reflective, reflections can be rendered using the SSR technique.

 

  • Good 2
  • 1 month later...

Implemented a new water rendering technique. The screenshots below show water with and without reflections. Because the game does not data for different types of water (ocean, pond, lake, river, etc), I chose to go with more calm water with low waves. The water parameters can be changed to create a different simulation.

spacer.png

spacer.png

 

This still needs improvements. Later I will add refraction and dynamic normal maps. For now, this will do.

  • Metin2 Dev 1
  • Good 1
  • Love 1
  • Love 5
  • 1 month later...

Metin stones and effects

I have been hearing about the performance impact of metin stones and effects since I entered the scene. But are metin stones really as heavy as many say they are? Metin stones don't appear to be complex objects but looks can be deceiving, so I decided to investigate what impact these stones (and effects) have on performance. These are the testing conditions:

  • Resolution: 1920 x 1080;
  • Map: Map A1;
  • Field of View: 45 degrees (vertical);
  • Metin stone count: 750 (arranged in a 25x30 grid, the stones are interleaved, so that they don't arrive at the renderer in an optimal order);
  • Clients: TMP4 (Reference); Old version of my D3D11 Renderer and the new optimized version.
  • Builds: All clients use Distribute.

OK with that out of the way let's start testing.

TMP4 (reference):

spacer.png

  • Metin stones only: 23 ms (~43 FPS);
  • Metin stones and effects: 73 ms (~14 FPS);

Yeah, performance is pretty bad.

Let's see how the old version of the renderer fares:

spacer.png

  • Metin stones only: 12 ms (~ 83 FPS), 37 ms (~27 FPS. Shadows, AO and DoF set to max quality);
  • Metin stones and effects: 40 ms (~25 FPS), 65 ms(~15 FPS. Shadows, AO and DoF set to max quality);

While the renderer beats reference, as soon as graphical features are activated or there are a lot of effects, the performance becomes unacceptable.

This hardware, while not high end by modern standards should be able to breeze through this test scene. So, it's time to optimize.

After working on this for weeks, these are the results:

spacer.png

  • Metin stones only: ~6 ms (~ 166 FPS, 32-bit exe); ~4 ms (~250 FPS, 64-bit exe);
  • Metin stones and effects: 7 ms (~142 FPS, 32-bit exe); 5 ms (~200 FPS, 64-bit exe);

This is a much, much better result. The overhead from effects became negligible, and we are able to render with graphics features set to max quality without worrying about performance. OK this is great so what are the disadvantages? When many effects are close together like this, some flickering can be observed. This can probably be mitigated by sorting the effects in a way that produces more consistent output (by distance perhaps?).

64-bit brings around 30% performance improvement, so in my opinion, it's worth it.

So that's it, the fearsome metin stones and their effects have been conquered. This should be good enough for most scenes while leaving enough performance headroom for other things.

  • Metin2 Dev 2
  • Scream 1
  • Love 6
  • 5 months later...
16 hours ago, DramaLama said:

Are you still working on this? Looked super interesting overall.
If not, is there any chance you'll share the last state, so others can make something from it?

Would be kinda sad if it just dies completely.

I am still developing it. There will be updates in the future.

I haven't had the time to work on it lately, but I will update it as soon as my schedule frees up.

  • Love 1
  • 2 weeks later...
  • 4 months later...
  • Active+ Member

Any new updates? Are you, by any chance releasing these? 

I'm so curious about the light spots. I'm most interested in that. Is there a way to share / sell that part of adding individual light spots? Currently I'm working on a dumb question by grabbing GTAVC map into the metin2 and these kind of lights you added is exactly what I need. 

Even tho, no options from above are available, I'm still waiting to see new updates on your work. Good job! 

13 hours ago, KolenMG said:

Any new updates? Are you, by any chance releasing these? 

I'm so curious about the light spots. I'm most interested in that. Is there a way to share / sell that part of adding individual light spots? Currently I'm working on a dumb question by grabbing GTAVC map into the metin2 and these kind of lights you added is exactly what I need. 

Even tho, no options from above are available, I'm still waiting to see new updates on your work. Good job! 

Right now, I am working on stability and fixing some efficiency issues. After that I have some features planned.

Regarding lights, is there a reason you can't simply add more lights to your scene? If you use the fixed function pipeline, the maximum number of lights available is driver dependent (but you can expect at least 8 to be available). If you use the programmable pipeline (shaders), then the number of lights you can have is pretty much unlimited. In my renderer I limited the maximum number of lights to 24 due to performance concerns (mostly for entry level/low end hardware. Decent hardware can handle much more than that).

Edited by TheEqualizer
  • Metin2 Dev 1

Don't use any images from : imgur, turkmmop, freakgamers, inforge, hizliresim... Or your content will be deleted without notice...
Use : https://metin2.download/media/add/

Please use https://metin2.download/ when uploading files smaller than 100MB, otherwise the approval will take longer due to manual upload.

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
×
×
  • Create New...

Important Information

Terms of Use / Privacy Policy / Guidelines / We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.