Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

DarkBASIC Professional Discussion / SET VERTEX SHADER VECTOR howto

Author
Message
Oryaaaaa
23
Years of Service
User Offline
Joined: 20th Mar 2003
Location: Aichi-ken, Japan
Posted: 26th Jun 2003 18:43
I do not understand the usage of VertexShader.
Which code does only have to be written in case of VertexColor?

The color of the polygon is applied by the Vertex color without doing the lighting.
---------------------VertexShader.dba---------------------
backdrop on : color backdrop 0 : sync on : sync rate 0
ObjectNumber=1 : VertexShaderNumber=1

load object "Sample.x",ObjectNumber
set vertex shader streamcount VertexShaderNumber, 3
VSDT_FLOAT2=0x01 : VSDT_FLOAT3=0x02 : VSDE_POSITION=0 : VSDE_TEXCOORD0=7
VSDT_D3DCOLOR=0x04 : VSDE_DIFFUSE=5
set vertex shader stream VertexShaderNumber, 1, VSDE_POSITION, VSDT_FLOAT3
set vertex shader stream VertexShaderNumber, 2, VSDE_DIFFUSE, VSDT_D3DCOLOR
set vertex shader stream VertexShaderNumber, 3, VSDE_TEXCOORD0, VSDT_FLOAT2

create vertex shader from file VertexShaderNumber,"vshader.vsh"
set vertex shader on ObjectNumber, VertexShaderNumber

??????????????????????????????????????????????

do
sync
loop

end
---------------------VertexShader.dba---------------------

---------------------vshader.vsh----------------------
vs.1.0
dp4 oPos.x , v0 , c0
dp4 oPos.y , v0 , c1
dp4 oPos.z , v0 , c2
dp4 oPos.w , v0 , c3
mov oD0 , v5
mov oT0.xy , v7
---------------------vshader.vsh----------------------

I want to know the example in which it is correct in this case, how to combine the following instructions etc.

SET VERTEX SHADER VECTOR VertexShader Number, Constant, Vector3, ConstantCount
SET VERTEX SHADER MATRIX VertexShader Number, Constant, Matrix4, ConstantCount

Are this Constant and what relation do you exist for vshader.vsh? What does ConstantCount show? The material of DBpro is extremely little though the material of VC++ is numerous. It is a Black Box now though will be able to understand if the DBpro source in this part is open to the public.
DarkBasicProfessional is wonderful.
Shadow Robert
23
Years of Service
User Offline
Joined: 22nd Sep 2002
Location: Hertfordshire, England
Posted: 26th Jun 2003 20:21
Vertex Shader Tutorial Program


Simple.shader


this has all been translated from Microsoft Shader Tutorial Part1

i didn't bother to check if the shader matched up exactly with my DBP code though - i have a feeling that it doesn't so you might have to edit the constants being passed other than that should show quite extensively howto setup vertex shaders and use them.
i'll update this a little later once i can get onto my GeForceFX machine and test it.

I pride myself that i don't kill...
well not without a good reason
Shadow Robert
23
Years of Service
User Offline
Joined: 22nd Sep 2002
Location: Hertfordshire, England
Posted: 26th Jun 2003 20:40
oki... that won't work, i was just checking over it - i'll update working later (some embarrasingly HUGE mistakes in it lol)

I pride myself that i don't kill...
well not without a good reason
Shadow Robert
23
Years of Service
User Offline
Joined: 22nd Sep 2002
Location: Hertfordshire, England
Posted: 27th Jun 2003 02:12
oki doki... i'm hopeing this is now working fully
still not system to test on.

1.01.r5.Retail


simple.vsh




hopefully it is all working now... although one beta testers system is totally messed up (not the fault of the shader though ) and the other is too lazy to get off his laptop to try it lol

I pride myself that i don't kill...
well not without a good reason
Oryaaaaa
23
Years of Service
User Offline
Joined: 20th Mar 2003
Location: Aichi-ken, Japan
Posted: 27th Jun 2003 10:41
Raven announces and appreciates for the wonderful source code. If it is this, I can learn.

I had Japanese programmers guess a command.
IDirect3DDevice9::SetVertexShaderConstantF
> SET VERTEX SHADER VECTOR VertexShader Number, Constant, Vector3, ConstantCount
> SET VERTEX SHADER MATRIX VertexShader Number, Constant, Matrix4, ConstantCount

I can understand by the source code Raven indicated the set method of a color to be. The remainder became only a portion about FVF.

CONVERT OBJECT FVF : CONVERT OBJECT FVF Object Number, FVF Format

Finally I want to understand also about this imperative sentence. Please tell Mr. Raven and me.

DarkBasicProfessional is wonderful.
Shadow Robert
23
Years of Service
User Offline
Joined: 22nd Sep 2002
Location: Hertfordshire, England
Posted: 27th Jun 2003 14:28
How this works is simple.

FVF is like a buildable Model Format, all the data for a model is specified when you load it using the
LOAD OBJECT Object Number

But when you work with shaders you don't always want to specify ALL of the data that the model has to offer, which is reason for FVF.

With these types



the streamed data should mimic the data that you've specified within the format header that you set using
CONVERT OBJECT FVF : CONVERT OBJECT FVF Object Number, FVF Format

its all just a binary switch value, which meanns that

( FVF_XYZ ) will turn on the first bit and it'll look like
%0000 0000 0000 0001
if you did (FVF_XYZ||FVF_NORMAL) it'd return
%0000 0000 0000 1001

hopefully that helps

I pride myself that i don't kill...
well not without a good reason
Oryaaaaa
23
Years of Service
User Offline
Joined: 20th Mar 2003
Location: Aichi-ken, Japan
Posted: 28th Jun 2003 11:12
I understood thanks to Raven. Thank you.

I wrote the program of VertexShader with the same meaning as "Load object".



When the program of VertexShader is written, the parts such as # constant and r=make are needed without fail. This becomes a regulations complaint.


However, I do not understand the method of setting the DIFFUSE color.

global dwColour as dword : dwColour = rgb(128,128,196)
set vertex shader vector VertexShaderNumber, 8, dwColour,1

It becomes Vector error when it is this method, and it is not possible to execute it. This part is not understood. How do you do?

DarkBasicProfessional is wonderful.
Shadow Robert
23
Years of Service
User Offline
Joined: 22nd Sep 2002
Location: Hertfordshire, England
Posted: 28th Jun 2003 12:44
hmm that must've been the vector that Lee was talking about the other day... i knew i'd missed something stupid

change those lines to



that should make more sense
also beware the dp4 register doesn't work in DBP, use m4x4 instead

I pride myself that i don't kill...
well not without a good reason
Oryaaaaa
23
Years of Service
User Offline
Joined: 20th Mar 2003
Location: Aichi-ken, Japan
Posted: 28th Jun 2003 13:29
It became clear altogether now. Thank you, Raven

I can write the report for Japanese.

DarkBasicProfessional is wonderful.
Shadow Robert
23
Years of Service
User Offline
Joined: 22nd Sep 2002
Location: Hertfordshire, England
Posted: 28th Jun 2003 13:45
glad to have helped

I pride myself that i don't kill... well not without a good reason
Oryaaaaa
23
Years of Service
User Offline
Joined: 20th Mar 2003
Location: Aichi-ken, Japan
Posted: 29th Jun 2003 06:34
I understood the usage of VertexShader.
However, the part that doesn't understand again has increased.

It is a method of setting constant (c0...) with the type of FLOAT1, FLOAT2, and FLOAT4. Are not you ..cannot the others setting.. though can use the type of FLOAT3 by "Set vertex shader vector"? An expression possible by VertexShader decreases very much if it is so.

When you quote an internal file of DirectX
// bit declarations for _Type fields
#define D3DVSDT_FLOAT1 0x00 // 1D float expanded to (value, 0., 0., 1.)
#define D3DVSDT_FLOAT2 0x01 // 2D float expanded to (value, value, 0., 1.)
#define D3DVSDT_FLOAT3 0x02 // 3D float expanded to (value, value, value, 1.)
#define D3DVSDT_FLOAT4 0x03 // 4D float
#define D3DVSDT_D3DCOLOR 0x04 // 4D packed unsigned bytes mapped to 0. to 1. range

typedef struct _D3DCOLORVALUE {
float r;
float g;
float b;
float a;
} D3DCOLORVALUE;

Or, do I only have to make it by using only the type of FLOAT3?
VertexShader becomes a conclusion that cannot be used in DBPro.

If DBPro supports the constant set of FLOAT4, the problem is solved.

set vertex shader Float4 ShaderNO, c?, c.x, c.y, c.z, c.w

FLOAT2
set vertex shader Float4 ShaderNO, c?, c.x, c.y, 1, 1
FLOAT3
set vertex shader Float4 ShaderNO, c?, c.x, c.y, c.z, 1
FLOAT4
set vertex shader Float4 ShaderNO, c?, c.x, c.y, c.z, c.w

Does Lee think about this?

DarkBasicProfessional is wonderful.
Shadow Robert
23
Years of Service
User Offline
Joined: 22nd Sep 2002
Location: Hertfordshire, England
Posted: 29th Jun 2003 13:36 Edited at: 29th Jun 2003 13:39
you should be able to set that with the set vertes shader vector

remember that its inputs are
set vertes shader vector shader number, constant position, constant, size

although he puts that it is vector3 only, a size of 1 is float1, size of 2 is float2, size of 3 is float3 you get the idea.

and remember there is always the constant stream, as alot of the time you can set static constants through that.
but Lee is changing alot of the Update5 to give us better Asm support.

[edit]
i'm not sure how right now becuase i'm unsure on howto get instance pointers at the moment - but once i learn i could give you a TPF DLL which extends your shader inputs
would have to checkout the instance setup again though to make sure i don't so any damage.

I pride myself that i don't kill... well not without a good reason
Oryaaaaa
23
Years of Service
User Offline
Joined: 20th Mar 2003
Location: Aichi-ken, Japan
Posted: 30th Jun 2003 07:02
No, it will become like this.
FLOAT1 vector3=(x,0,0) c0 x,0.0f,0.0f,1.0f
FLOAT2 vector3=(x,y,0) c0 x, y,0.0f,1.0f
FLOAT3 vector3=(x,y,z) c0 x, y, z,1.0f
FLOAT4 ShaderProgram def c0, x, y, z, w
It was wrong. What is necessary is just to describe FLOAT4 directly to ShaderProgram.

>Lee is changing alot of the Update5 to give us better Asm support.
DBPro Patch4.1 = DirectX 8.0a SDK VS.1.0
DBPro Patch5.0 = DirectX 9.0a SDK VS_1.1
Thus, I think that it changes.

DarkBasicProfessional is wonderful.
Oryaaaaa
23
Years of Service
User Offline
Joined: 20th Mar 2003
Location: Aichi-ken, Japan
Posted: 30th Jun 2003 07:25
ENGLISH -> JAPANESE , JAPANESE -> ENGLISH
http://www.excite.co.jp/world/text/

DarkBasicProfessional is wonderful.
Shadow Robert
23
Years of Service
User Offline
Joined: 22nd Sep 2002
Location: Hertfordshire, England
Posted: 30th Jun 2003 08:33
no i know how it works but i'm pretty sure you can export a vector4 (float4) using the vector command too... just by setting it to 4 instead of 1. that way it exports each value as a seperate.

i hope that update5 include swizzleing though, been missing being able to use that.

there are alot more changes between Dx8.1 and 9.0's shaders, essentially the same but you've gotta declare things differently
and thanks for the link

I pride myself that i don't kill... well not without a good reason

Login to post a reply

Server time is: 2026-07-17 13:56:59
Your offset time is: 2026-07-17 13:56:59