0

I've made a HLSL shader (fx format) and would like to add a enum/list paremeter to its UI - as a better alternative to the list of boolean flags.

So instead of :

  • [x] "Use custom map"
  • [x] "Use custom map alpha"
  • [x] "Use diffuse alpha"
  • [x] "Use specular alpha"
  • [x] "Use normal alpha"

have:

  • Source: [ "Use custom map" ]

with all 5 choices and the index to selected item on the code level.

"DirectX Standard Annotations and Semantics Reference" mentions about the ListPicker widget but I can't find any example or description how to use it.

The questions are:

  • Is it possible to have a custom dropdown-like widget in the shader's UI?
  • How to achieve it?
mslaf
  • 55
  • 1
  • 7
  • A shader doesn't have a UI ... are you sure you aren't talking about DXUT? – Goz Jan 06 '11 at 14:37
  • FX shaders do have user parameters (passed by the user not the application) and those are associated with UI controls - where user may set/adjust parameter values. It's the same for HLSL (FX) and CGFX. float3 parameter/control definition: float3 g_ConstantColor < string UIName = "Constant color"; string UIWidget = "Color"; > = {1.0f, 1.0f, 1.0f}; flaot3 parameter/control definition: float g_ConstantScale < string UIName = "Constant scale"; string UIWidget = "slider"; float UIMin = 1.0f; float UIMax = 10.0f; float UIStep = 0.25f; > = 1.0f; etc. one of them is list/enum type. – mslaf Jan 06 '11 at 17:17

1 Answers1

2

SAS allows you to set parameters like these but it is entirely ignore by the shader itself. It is purely meta-data for another system to use if/when it needs too ... it does NOT handle rendering of the UI. If you want a UI then you have to read this semantic & annotation data and use it to draw a UI. Either that or use an application that recognises the semantics/annotations structure ...

Goz
  • 61,365
  • 24
  • 124
  • 204
  • Yes, Shaders don't have a UI. Sas compliant parameters bind the shader to the host application and the application may or may not create the UI for them. It's not the host application but SAS (the name states for itself) defines a standard for parameter annotations. Those annotation are defined according to SAS rules and are part of the shader code. It doesn't matter, if the GPU doesn't care about them. My question was about the format or example, explaining how this annotation should look so the host application will be able to create the UI control for its parameter. – mslaf Jan 13 '11 at 18:58
  • @mslaf: Fair enough. What software is supplying the UI then? Giving you a combo box UIWidget would totally depend on whether the software supports one (It is not a standard DXSAS type). – Goz Jan 13 '11 at 20:17
  • FX Composer and XSI - and frankly, I have no idea, if they do support such combos but could not figure it out otherwise, that providing something that matches the SAS docs. The ListPicker is mentioned there without a word of explanation. I'd be happy to see something based on this explanation and works in other shader editing programs like max with mental mill's plugin. So far I assumed, that the information I've provided as annotations are in the wrong format and thus the host app. was unable to render the controls. But It's possible that the host won't render it anyway. – mslaf Jan 14 '11 at 14:20