Author Topic: [INFO] Shader Stuff- HLSL instruction limits  (Read 21766 times)

0 Members and 1 Guest are viewing this topic.

Barabas

  • Master Knight
  • *
    • View Profile
  • Faction: Neutral
  • MP nick: Bassa Bar
  • WB
Re: [INFO] Shader Stuff- HLSL instruction limits
« Reply #360 on: March 02, 2012, 11:00:17 AM »
Hmm... so what can we use it on, only sceneprops (including flora)?

Vincenzo

  • External Developer
  • *
  • Coder of code
    • View Profile
    • Flying Squirrel Entertainment
  • Faction: Neutral
  • MP nick: FSE_Vincenzo
  • M&BWBWF&SNW
Re: [INFO] Shader Stuff- HLSL instruction limits
« Reply #361 on: March 02, 2012, 11:33:07 AM »
Scene props only, don't use it on flora, in-engine a lot of auto batching and instancing is automagically done.
 

Barabas

  • Master Knight
  • *
    • View Profile
  • Faction: Neutral
  • MP nick: Bassa Bar
  • WB
Re: [INFO] Shader Stuff- HLSL instruction limits
« Reply #362 on: March 02, 2012, 11:46:47 AM »
Is that true for the auto-generated flora only or also for manually placed stuff?
If it also works on manually placed stuff, how does it know what to batch/instance? Or does it only work on objects that use the flora or grass shader? So would it then be beneficial to use it for tree trunks?

questions questions questions!

Slawomir of Aaarrghh

  • Master Knight
  • *
    • View Profile
    • The Deluge
  • Faction: Neutral
  • MP nick: Daedalus
  • M&BWBWF&S
Re: [INFO] Shader Stuff- HLSL instruction limits
« Reply #363 on: March 02, 2012, 01:46:57 PM »
Don't use instancing on weapons.

Except that there are more issues including clipping issues.

Native weapons and missiles used instancing, so now I'm a little lost here... :| Should we do as in Native and use the instancing, or should we rather stick to non-instaced shaders? :?


And for those disappearing weapons - from what I heard after disabling/enabling instancing in game options everything started working fine.

Vincenzo

  • External Developer
  • *
  • Coder of code
    • View Profile
    • Flying Squirrel Entertainment
  • Faction: Neutral
  • MP nick: FSE_Vincenzo
  • M&BWBWF&SNW
Re: [INFO] Shader Stuff- HLSL instruction limits
« Reply #364 on: March 05, 2012, 08:21:27 AM »
If the flora is placed as a flora object in editor, or generated in random scenes, it will be handled as flora, where as the engine will use static batching on them and what not, so don't instance them yourself.

Note that you _always_ should have a LOD4 stage for all your flora (plants/trees etc anything that is placed as a flora object in-editor) and note that how the engine batches things, you should have a LOD4 stage that is not more then 300 verticles, preferably a lot less.


About instancing weapons, that could work out just fine in most cases, but, except the motion-blur-disappear issue.. There is another nasty side-effect with instancing; Basically the engine renders the vertices less accurate on a position in the scene, which could mean that when your 10 meters away from your weapon, and the weapon has multiple faces on top of each other (think of having a ring on top of the wood of a musket) the engine sometimes renders one verticle on top of the other and the other way around and you will see a constant flickering of these faces over each other which is problematic.
Scene props, generally don't have multiple faces on top of eachother, where as weapons usually do. But you could look into what to instance or not on a case by case basis.

Note that Instancing reduces CPU usage, but only in the DirectX thread, meaning if you have a multi-core machine, you will not notice any difirence, but users with bad CPU's will notice the change.
« Last Edit: March 05, 2012, 08:23:33 AM by Vincenzo »
 

xenoargh

  • Grandmaster Knight
  • *
    • View Profile
  • Faction: Neutral
Re: [INFO] Shader Stuff- HLSL instruction limits
« Reply #365 on: March 07, 2012, 05:07:53 AM »
Got fake Perlin noise implemented for ground shaders, to finally break up the monotony of the ground a bit more:

Before:


After:


Still needs work, but it's heading in the right direction, I think, and it's a cheap technique.

mark7

  • Sergeant
  • *
  • Crusaders Way to Expiation - Environment Work.
    • View Profile
  • Faction: Bandit
  • WB
Re: [INFO] Shader Stuff- HLSL instruction limits
« Reply #366 on: March 07, 2012, 09:55:22 AM »
How can these green spots be eliminated?


Vincenzo

  • External Developer
  • *
  • Coder of code
    • View Profile
    • Flying Squirrel Entertainment
  • Faction: Neutral
  • MP nick: FSE_Vincenzo
  • M&BWBWF&SNW
Re: [INFO] Shader Stuff- HLSL instruction limits
« Reply #367 on: March 07, 2012, 10:27:32 AM »
Take the vertex coloring out that is transfered from the engine into the vertex shader.
 

xenoargh

  • Grandmaster Knight
  • *
    • View Profile
  • Faction: Neutral
Re: [INFO] Shader Stuff- HLSL instruction limits
« Reply #368 on: March 07, 2012, 10:43:38 AM »
Be aware that that might, er, cause your level designers some hassles, though; vertex painting is one of the few tools you can use to change final color results, and is occasionally useful.

Anyhow, I'm still working on noise stuff; I ran into a weird issue where it really appears that Desert and Snow won't use secondary diffuse textures at all; well, that, or my algorithm just sucks, haven't decided yet  :lol:

OK, off to get some sleep.

Barabas

  • Master Knight
  • *
    • View Profile
  • Faction: Neutral
  • MP nick: Bassa Bar
  • WB
Re: [INFO] Shader Stuff- HLSL instruction limits
« Reply #369 on: March 07, 2012, 11:17:50 AM »
There are only a few textures that use 2 diffuse textures. Many are in 'overlay' mode, so the one beneath it can be seen through. I think this happens with rock, snow and maybe path? (apperently also dessert ^^)

cmpxchg8b

  • Modder++
  • Grandmaster Knight
  • *
  • Master of rglPool
    • View Profile
  • Faction: Vaegir
  • MP nick: cmp
  • M&BWBWF&SNW
Re: [INFO] Shader Stuff- HLSL instruction limits
« Reply #370 on: March 07, 2012, 11:38:39 AM »
If you want them to use a secondary texture change multitex_material_name in module_ground_specs.
Warband Script Enhancer v3.1.5 - additional operations, game scripts and triggers for Warband modders

Merlkir

  • Guest
Re: [INFO] Shader Stuff- HLSL instruction limits
« Reply #371 on: March 07, 2012, 03:23:17 PM »
Got fake Perlin noise implemented for ground shaders, to finally break up the monotony of the ground a bit more:

Before:
(click to show/hide)

After:
(click to show/hide)

Still needs work, but it's heading in the right direction, I think, and it's a cheap technique.

Interesting! Could ground decals (more specific types of ground textures, less blended into the native texture) be done?  (not sure how it's in Warband, but the limited number of ground textures is really quite crippling in MnB)

cmpxchg8b

  • Modder++
  • Grandmaster Knight
  • *
  • Master of rglPool
    • View Profile
  • Faction: Vaegir
  • MP nick: cmp
  • M&BWBWF&SNW
Re: [INFO] Shader Stuff- HLSL instruction limits
« Reply #372 on: March 07, 2012, 03:29:31 PM »
It's the same in Warband.
Warband Script Enhancer v3.1.5 - additional operations, game scripts and triggers for Warband modders

mark7

  • Sergeant
  • *
  • Crusaders Way to Expiation - Environment Work.
    • View Profile
  • Faction: Bandit
  • WB
Re: [INFO] Shader Stuff- HLSL instruction limits
« Reply #373 on: March 07, 2012, 05:54:23 PM »
Thanks for the help, have turned out :D

Before
(click to show/hide)

After
(click to show/hide)


Vincenzo

  • External Developer
  • *
  • Coder of code
    • View Profile
    • Flying Squirrel Entertainment
  • Faction: Neutral
  • MP nick: FSE_Vincenzo
  • M&BWBWF&SNW
Re: [INFO] Shader Stuff- HLSL instruction limits
« Reply #374 on: March 07, 2012, 06:27:03 PM »
Making it look quite dull....