PDA

View Full Version : VRay and Shaders - Assistance Needed



TomClancy
April 8th, 2009, 12:39 PM
Okay, this is probably going to be an insanely long post, but this has been bugging me for a long time now.

I play EVE (many of you may know of this game), and with it you can extract models and textures via a tool called TriExporter. I've gotten the model and textures for a ship (Rifter; Frigate Class).

I can render it with VRay and it looks alright, but nothing like the game or what other people have been coming up with. I discovered they have been manipulating the data found in the shader files (.RED) and inputting that data into their rendering engine. The guy I talked to didn't disclose what engine he uses, just some information about the shaders.

Here is a quick excerpt from the .RED file for the Rifter model I was referring to earlier:

type: EveShip2
turrets: []
name: "MF4"
mesh:
type: Tr2Mesh
geometryResPath: "res:/dx9/model/ship/minmatar/mf4/MF4_mod3Shape.gr2"
lowDetailGeometryResPath: "res:/dx9/model/ship/minmatar/mf4/MF4_mod3Shape_lowDetail.gr2"
opaqueAreas:
- type: Tr2MeshArea
name: "Cockpit"
effect:
type: Tr2Effect
name: "Cockpit"
effectFilePath: "res:/Graphics/Effect/Managed/Space/Ship/DoubleFresnelReflectionWithGlow.fx"
parameters:
- type: Tr2Vector4Parameter
name: "MaterialDiffuseColor"
value: [0.6117647, 0.5843138, 0.5568628, 1]
- type: Tr2Vector4Parameter
name: "MaterialSpecularFactors"
value: [0.3, 10, 0, 0]
- type: Tr2Vector4Parameter
name: "MaskDiffuseColor"
value: [0, 0, 0, 1]
- type: Tr2Vector4Parameter
name: "MaskSpecularFactors"
value: [2, 0, 0, 0]
- type: Tr2Vector4Parameter
name: "GlowColor"
value: [3, 1.6833, 0.8824, 1]
- type: Tr2Vector4Parameter
name: "FresnelFactors"
value: [2, 0.5, 0, 0]
- type: TriVariableParameter
name: "ReflectionMap"
variableName: "EnvMap2"
- type: TriVariableParameter
name: "ReflectionMapTransform"
variableName: "EnvMapTransform"
- type: Tr2Vector4Parameter
name: "ReflectionFactors"
value: [0.5, 2.5, 0.5, 1]
- type: Tr2Vector4Parameter
name: "MaskReflectionFactors"
value: [0.5, 0, 1, 0]
- type: TriVariableParameter
name: "MaskReflectionMap"
variableName: "EnvMap1"
- type: Tr2FloatParameter
name: "MaterialAmbientFactor"
value: 0.6
- type: Tr2Vector4Parameter
name: "MaterialSpecularCurve"
value: [50, 180, 0.5, 0]
- type: Tr2Vector4Parameter
name: "MaskSpecularCurve"
value: [170, 850, 0.35, 0]
- type: Tr2FloatParameter
name: "MaskAmbientFactor"
value: 0.6
- type: Tr2Vector4Parameter
name: "MaskFresnelFactors"
value: [1, 1, 0, 0]
resources:
- type: TriTexture2DParameter
name: "DiffuseMap"
resourcePath: "res:/dx9/model/ship/Minmatar/MF4/MF4_tex_d.dds"
- type: TriTexture2DParameter
name: "MaskMap"
resourcePath: "res:/dx9/model/ship/Minmatar/MF4/MF4_tex_p.dds"
- type: TriTexture2DParameter
name: "GlowNormalSpecularMap"
resourcePath: "res:/dx9/model/ship/Minmatar/MF4/MF4_tex_ngs.dds"
index: 3As you can tell, the .RED file links to .FX files. (There is a lot more to the shader than this.) When I navigate to the directory of the .FX file, it is in not in the .FX format. Rather, it's in .SM_3_0_hi, the compiled version of the .FX for the high-quality shader model 3 I'm assuming. Any way, the guy I talked to didn't talk much about the .FX files, just the parameters it talks about below.

He said this:

The values you see are for the vectors, they can manipulate color, lighting, glow or power of a parameter.
Most ships have multiable layers and colors, so you need to drop in the proper value to grab the proper color.
Vectors have 4 values when applied to a texture. [RED, GREEN, BLUE, ALPHA], but that is only when a parameter is calling colors. Otherwise its [VALUE1, VALUE2, VALUE3, VALUE4]
Glow controls lighting for the alpha layer on the diffuse map as defined in the .FX file.

Anywho, a good number of ships require 2 different shaders just for the tech 1 stuff.
There is a special tech 2 shader in the .RED file also.Which makes sense, only I can't figure out what to do this those values, and how to use them with VRay and 3ds Max. It goes completely over my head and I was wondering if anyone on this forum could assist me.

Just to give you an idea of the different between his renders and mine, I'll show a preview of his and mine.

His:
http://i41.tinypic.com/3505ph4.jpg

Mine:
http://img139.imageshack.us/img139/3371/rifter1.jpg
(My lighting is pretty awful too.) Just two VRayLights above and to the sides of it.

His is obviously more sleek and better rendered than mine. We both used the same materials (Diffuse, Specular, Normal etc.)

Thank you for reading!
Anthony

I added more to the CODE section, might help a bit more. Finished up the parameters and such for that portion of the Shader.

DEElekgolo
April 8th, 2009, 12:49 PM
His render looks like it is from Unreal Engine. So it should not be hard to simulate. In if you want the smooth effect he has then you can use the "Highlight gloss" perimeter in the vray material and set it to something like 0.8 or 0.6.

TomClancy
April 8th, 2009, 02:07 PM
That's not what I'm looking for at all. Had you read my read my post you would know I want to figure out how to use the shader parameters with VRay.

DEElekgolo
April 8th, 2009, 02:34 PM
The first value in Fresnel factors is the Fresnel IOR for reflection(2). Material specular factors is highlight gloss(0.3). The material color uses float values to multiply them each by 255 to get RGB values that can can use which would be your reflection color and exit color. This should do but I do not know how exactly it will look without the source bitmaps.
http://img5.imageshack.us/img5/6056/10694122.jpg

TomClancy
April 9th, 2009, 01:17 AM
I tried it, not what I'm looking for. Since it's Fresnel Reflection, yet you material is showing some refraction?

It's not for glass, it's for the hull of a ship, heh. Cockpit rather, but the glass on those is opaque.

DEElekgolo
April 9th, 2009, 02:10 PM
My material isnt showing refraction. You can see in the picture that the refraction is off. It is only reflecting.

TomClancy
April 10th, 2009, 12:06 PM
Ah, my bad. I thought it was refracting the material behind it.
I am however, not exactly sure how to use this material along with a diffuse, specular, normal bitmaps? Any ideas?

DEElekgolo
April 10th, 2009, 01:40 PM
You can put the diffuse in the diffuse and put the specular in the slot next to the reflection color. For the bump map, you need to scroll down and put a "normal bump" in the bump map slot. And then put your normal map in the first slot of the "normal bump"

TomClancy
April 10th, 2009, 03:50 PM
Oh, I gotcha. I was thinking this as a separate material, my bad.