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 / .FX Has anyone had any success?

Author
Message
AsylumHunter
23
Years of Service
User Offline
Joined: 3rd Oct 2002
Location: United States
Posted: 7th Sep 2003 06:29
I've been experimenting with the EFFECT shaders for several days now with little results. I would be really interested to know if other programmers have had any luck.

I have the following
DX9.0b
Latest Detonator Drivers 45.23
XP
GForce Ti 4600 (128Mb)
NVidia's Complete SDK 6.1
Dozens of .FX Cg scripts that work perfectly in the CgFX viewer

However, only a few of these (3rd Party) FX Scripts run, never mind work correctly. The ones that load tend to load their textures correctly (after I figured out I had to change the paths), but either the mapping or FX is all screwy or is static. The ones that just die, simply give a general "Effect Does Not Exit" error, even if I state the required technique (default or otherwise)

Hmm, All of the example scripts with Update 5 work fine.

Are these the only scripts that do? I simply want some decent bumpmapping!

What are you experiences? I'm getting very frustrated.

-AsylumHunter

still falling out of my binary tree (hicup!)
Bulleyes
23
Years of Service
User Offline
Joined: 3rd Nov 2002
Location: Cyberjaya, Malaysia
Posted: 7th Sep 2003 11:05
Yup! I managed use the FX system to create my own bump + specular mapping. It looks great, and I like the FX system. Prior the presence of FX system in DBpro, I was struggling with the Vertex and Pixel shader functions, and I am eventually stuck. (I need to change the FVF to get the tangent texture coordinate but I couldn't get it no matter how hard I tried.)

What problem are you facing? Maybe I can help you out.
I am not very good in those Computer Graphics math, thus I achieve my bump + specular mapping by porting the Cg samples come from CgFX Viewer to the DirectX HLSL in a .FX file.

Oh, BTW, my spec are:

DX 9.0b
GeForce 4 TI 4200 with 64MB SDRAM
256 MB System RAM running on XP.


And this is the screenshot of my bump + spec map on a simple sphere. It looks cool to me.



Bad Nose Entertainment - Where games are forged from the flames of talent and passion.

http://www.badnose.com/
Rob K
Retired Moderator
23
Years of Service
User Offline
Joined: 10th Sep 2002
Location: Surrey, United Kingdom
Posted: 7th Sep 2003 14:10
@Bulleyes

That looks excellent. Can you post the FX / media for that?

@AsylumHunter

Have you tried the bump mapping under U5? It is much better than it was in retail-P4.1

If you send any non-working FX files to Lee he may be able to help. As is stated in the docs. The FX system is an ongoing project.

David T
Retired Moderator
23
Years of Service
User Offline
Joined: 27th Aug 2002
Location: England
Posted: 7th Sep 2003 14:36 Edited at: 7th Sep 2003 14:52
Yep - I've managed to get some shiny objects with FX.

I've tried to port some examples from mthe nVidia CfFx viewer yet not knowing HLSL I'm at a bit of an disadvantage

http://www.davidtattersall.me.uk/db/images/spacertssc6.jpg See planet


Specs:

xp
geforce 4 ti4800
1 gig ram
althlon 2800+

Theres no place like 127.0.0.1
There are 10 people in this world, those who understand binary and those who don't
Bus station = where bus stops. Train station = where train stops. Workstation = ?
Shadow Robert
23
Years of Service
User Offline
Joined: 22nd Sep 2002
Location: Hertfordshire, England
Posted: 7th Sep 2003 20:03
i have one FX working atm, personally i hate the coding structure of them - bleck!
is a pain to convert my Cg code, i know and love.

got a good few asm shaders working though and perfectly under the new shader system
very impressed with update5 and its shader support so far
the thing that confuses me is the implimentation of aspects of the .fx is the string import tags ... something to get used to i suppose unless i can convince Lee to add the Cg interface for 6.0
(would make things alot simpler )

i've been trying to plan out a few good tech demo's using shaders,
currently i have a few ideas but not started any.
i have one i'll be working on today ... gonna be a space demo - have like a few planets in the background, a sun perhaps in a few asteroids, have like this one big ship fighting with a few smaller ships. Force field effect, laser effects, rocket effects... ya know just a few things.

its not particularly heavy work for shaders really, however it'll help me in something i'm doing.

Bulleyes
23
Years of Service
User Offline
Joined: 3rd Nov 2002
Location: Cyberjaya, Malaysia
Posted: 8th Sep 2003 17:31
Rob K:
Sure, no problem. But I think I can only post the FX file here, since I can't figure out how to ZIP all the media files and upload it here.

Bad Nose Entertainment - Where games are forged from the flames of talent and passion.

http://www.badnose.com/
Bulleyes
23
Years of Service
User Offline
Joined: 3rd Nov 2002
Location: Cyberjaya, Malaysia
Posted: 8th Sep 2003 18:07
There, I had attached the FX file at the source section for my bump + spec mapping. I will briefly explain how to use it.

What you need:
1. a diffuse texture - this is basically the main texture that determines how the model look like. It more commonly to known as just texture map (I follow the term diffuse texture as stated in MAX).

2. a normal map texture - this texture is maily used for bump mapping. Every pixel in this texture are the normal vector of the model. Each RGB channel of each pixel in this texture correspond to each XYZ component of the normal vector. To create normal map manually is somewhat involved. Generally, I would create a grayscale heightmap and use the NVidia plugin for Photoshop to convert it into normal map.

3. a specular map texture - this is a gray scale texture that determines the surface specularity of the model. Full white indicates full specularity, and pure black means no specularity. For example, if you had a brickwall with a marble patch in the middle. The portion that made of bricks might have less specularity specified in the specular map, compare to the marble patch.

Instruction:
1. Load your model via LOAD OBJECT.
2. To specified the three different textures stated above on your model, there are two ways:

METHOD A:
=========

- call TEXTURE OBJECT objNo, txtLvl, txtMap
with txtLvl as 0, txtMap point to your loaded diffuse map,
txtLvl as 1, txtMap point to your loaded normal map,
txtLvl as 2, txtMap point to your loaded specular map.

For example:

LOAD OBJECT "sphere.x", 10

LOAD IMAGE "diff.tga", 100
LOAD IMAGE "norm.tga", 101
LOAD IMAGE "spec.tga", 102

TEXTURE OBJECT 10, 0, 100
TEXTURE OBJECT 10, 1, 101
TEXTURE OBJECT 10, 2, 102


METHOD B:
=========
- Hard code the filename of the three texture maps in the FX file.
- At line 5, 6, and 7, modify the filename into your diffuse, normal, and spec map filename respectively.


Personally, I prefer METHOD A, since it makes my FX file more reusable, although there is more code need to be written in your DBpro source file.

3. call LOAD EFFECT "bumpspec.fx", fxNum, flag
bumpspec.fx will be my bump + spec FX file.
fxNum will be any integer greater than zero serve as a reference index to the loaded effect.
flag must set to 0 if you choose METHOD A in previous step, otherwise set to 1 if you choose METHOD B.

4. SET OBJECT EFFECT objNum, fxNum
where objNum is the reference index to your object, and fxNum is as stated in step 3.

Voila! Now you got the cool bump + spec map effect as the screenshot shows. Nifty eh?

Hoped this is detail enough.
Good luck!

Bad Nose Entertainment - Where games are forged from the flames of talent and passion.

http://www.badnose.com/
Bulleyes
23
Years of Service
User Offline
Joined: 3rd Nov 2002
Location: Cyberjaya, Malaysia
Posted: 8th Sep 2003 18:17
Oops.. forgot to tell you guys about its limitation.

1. Currently, my bump + spec map only works for directional lights. It can be modify easily for point lights as well (if you know to semantic annotation used in FX file). Support for spot lights might be more difficult. Anyone can help me?

2. It only support ONE light source, which is the default LIGHT #0. Supporting multiple lights obviously requires more computation, and I yet to have any clue how to implement it. (Hey, c'mon, I had just explored the FX system for one month, part time, so cut me some slack.)

3. The specular lighting only calculate correctly if your 3-D object are modelled centered respect to the local origin.

4. Some obvious banding effect on the specular highlighting upon close up. This is due to the small precision of the pixel shader register. Read more about this at http://www.gamedev.net/columns/hardcore/dxshader4/page2.asp


That's about it which I can think of.
Any compliments, bugs or suggestions, feel free to email me.

"Pushing towards the limit of DBpro!"

Bad Nose Entertainment - Where games are forged from the flames of talent and passion.

http://www.badnose.com/
Rob K
Retired Moderator
23
Years of Service
User Offline
Joined: 10th Sep 2002
Location: Surrey, United Kingdom
Posted: 8th Sep 2003 18:18
@Bulleyes

If you want to send me the zip file or media files and I'll host it for you - [email protected]

Thanks for the help

Bulleyes
23
Years of Service
User Offline
Joined: 3rd Nov 2002
Location: Cyberjaya, Malaysia
Posted: 8th Sep 2003 18:24
Arghh... the forum engine swallows all the angle brackets in my FX file.

If you can't get the FX file compiled, fix it by replace line 146 to line 168 to the following:



Bad Nose Entertainment - Where games are forged from the flames of talent and passion.

http://www.badnose.com/
Shadow Robert
23
Years of Service
User Offline
Joined: 22nd Sep 2002
Location: Hertfordshire, England
Posted: 8th Sep 2003 18:32
Quote: "It only support ONE light source, which is the default LIGHT #0. Supporting multiple lights obviously requires more computation, and I yet to have any clue how to implement it."


setup the bump/normal and spec shading as seperate routines and run them conclusive times for the number of lights - it'll take what is already there and just add the new lights as your old stuff will already be done in the buffer

Quote: "Currently, my bump + spec map only works for directional lights. It can be modify easily for point lights as well (if you know to semantic annotation used in FX file). Support for spot lights might be more difficult. Anyone can help me?"


lighting computations are pretty simple to do for all effects, if you goto cgshader.org there is a list somewhere of the computations for the different types.
i might actually have my standard material Cg script somewhere about, not much good in its present state but no worries.

also if you want higher resolution on your pixel shaders user 2.0 spec, they tend to use 32bit(24bit) rather than 16bit(12bit)
your gf4 should be able to support them.

Rob K
Retired Moderator
23
Years of Service
User Offline
Joined: 10th Sep 2002
Location: Surrey, United Kingdom
Posted: 8th Sep 2003 20:04
Quote: "your gf4 should be able to support them."


GF4s only support PS1.4 / VS1.1

Only the GeForceFX and Radeon 9000 series support PS/VS 2.0. The very latest cards in those series also support 128bit graphics (mmmm )

Chenak
23
Years of Service
User Offline
Joined: 13th Sep 2002
Location: United Kingdom
Posted: 8th Sep 2003 23:59
Doesnt compile for me

It doesnt like this line of code:

PS_OUTPUT PDiffShader(PS_DIFF_INPUT input)

the error says its a syntax error and that its an unexpected token (whatever that is)

Cheers

Once you start down the Dark Path, forever will it dominate your destiny...
Chenak
23
Years of Service
User Offline
Joined: 13th Sep 2002
Location: United Kingdom
Posted: 9th Sep 2003 00:07
Never mind its fixed now, dont know why it did that... just some weird error.

Anyway its fantasic! ive bin looking for a ppl shader that works for ages.

Thanks again

Once you start down the Dark Path, forever will it dominate your destiny...
Bulleyes
23
Years of Service
User Offline
Joined: 3rd Nov 2002
Location: Cyberjaya, Malaysia
Posted: 9th Sep 2003 05:59
I hoped you like it, Inferno. I like shader programming a lot as I enjoy creating special effects. Ever since the introduction of HLSL and Cg, it makes my life even more easier. Right now I am programming some kind like a volumetric light effects.

Maybe you can name me some of the effect that you always look forward to. I wanna compile a library of FX files for the DBpro community.

Bad Nose Entertainment - Where games are forged from the flames of talent and passion.

http://www.badnose.com/
David T
Retired Moderator
23
Years of Service
User Offline
Joined: 27th Aug 2002
Location: England
Posted: 9th Sep 2003 20:33
name me some of the effect that you always look forward to

Volumetric fog hopefully volumetric light'll do it

Theres no place like 127.0.0.1
There are 10 people in this world, those who understand binary and those who don't
Bus station = where bus stops. Train station = where train stops. Workstation = ?

Login to post a reply

Server time is: 2026-07-25 02:08:29
Your offset time is: 2026-07-25 02:08:29