Jump to content

Pine tree


Go to solution Solved by Szico VII,

Recommended Posts

Here's another one of my attempts at creating stuff from scratch, with 3DS Max and (barely) Photoshop.

 

I still think the tree looks a bit confused, and it's been some months since I last worked on it, but it honestly looked a bit better than what I expected in the beginning. 426 triangles currently. Trees aren't lightmapped yet.

 

Would like some feedback on what could be better.

 

 

 

 

pinetree1.jpg

 

pinetree2.jpg

 

 

therfiles likes this
Link to comment

 

 

Thanks for the links! I think I'll find them very handy, except I won't use a script for it. I still have too much to learn :P

 

I followed this tutorial, if you skip through it a few places you'll see where I was coming from: 

I'll try to see if I can make a more true to life edition though!

Link to comment

I think the only problem with the pine tree is that we see it the very light environment. :) In any other map the pine would work just perfectly, I think. As for the similarity, I am not sure that is needer: hey, you are creating a model for a Star Wars game! The trees there might not look the way we see them in our life.

 

I have a question regarding the shaders of the branches. Sometimes they would behave nasty in the game, so I wonder, does the shader works fine with the pine? What I mean, is that the shader for hair, leaves and other staff which deals with alpha channel of tga or a png file sometimes works weirdly.

 

Funny thing: in the past it was so hard to create a world which wouldn't look like ours, and now we all try to recreate the perfect reality. :D

Link to comment

I think the only problem with the pine tree is that we see it the very light environment. :) In any other map the pine would work just perfectly, I think. As for the similarity, I am not sure that is needer: hey, you are creating a model for a Star Wars game! The trees there might not look the way we see them in our life.

 

I have a question regarding the shaders of the branches. Sometimes they would behave nasty in the game, so I wonder, does the shader works fine with the pine? What I mean, is that the shader for hair, leaves and other staff which deals with alpha channel of tga or a png file sometimes works weirdly.

 

Funny thing: in the past it was so hard to create a world which wouldn't look like ours, and now we all try to recreate the perfect reality. :D

 

You're right that it could probably be good enough for certain maps or certain standards. My real goal is to improve my skills though, and prepare myself for making content for games. I would really like to have the consistency to be able to re-do something I've made, expand my logical thinking, and generally just the process of taking feedback and trying to improve what you're making. That's an important skill to learn even if it might be starting to look nice.

 

Hmm in what way do these shaders work weirdly? This works fine though, it's just a simple shader using the alpha channel for transparency. I'd have to do some more changes to the shader probably when this tree is lightmapped, because it will cast shadows on the other branches and might have some unnatural dark spots etc.

 

I guess I'm quite fascinated with trying to re-create real world stuff in games :P But I guess I find gameplay mechanics even more interesting on that area though. Stylized graphics is often a much more well-working approach on engines like this.

Link to comment

@@Psyk0Sith, I think maybe a bit of the issue is that it's not translated well into the game engine. I started working on a new texture for the branches, but when I opened 3DS Max, I realized that what I already had actually wasn't so bad.

 

Here is the exact same tree that I took screenshots if in-game, but in 3DS Max:

 

 

 

 

pinetree3DSmax.png

 

pintree3DSmax2.png

 

 

 

 

I think the shader is trying to go all-or-nothing on visibility. I seem to remember I can't have a $lightmap stage if I want gradual transparency.

 

What do you think about the tree as it looks in Max? And if it looks good, what approach would you take shaderwise?

therfiles likes this
Link to comment

Actually I was partially right/wrong. What was in 3DS Max was a different texture (made for building the pieces of the branches) but which turned out better visually.

 

Using shader methods taken from SP, I turn out with some issues. Each individual branch looks good, but they don't blend correctly with their fellow branches and other shaders, like the water in the background. Didn't wanna start a new thread for this, but I can do it if you (or anyone reading) don't know what it could be.

 

https://dl.dropboxusercontent.com/u/58757568/buggyBranches.jpg

models/map_objects/bootland/trees/pinestem4
{
	cull disable
	surfaceparm noimpact
	surfaceparm nomarks
	surfaceparm nonsolid
	{
	map models/map_objects/bootland/trees/pinestem4.tga
    blendFunc GL_SRC_ALPHA GL_ONE_MINUS_SRC_ALPHA
	}
	{
	map $lightmap
	rgbGen identity
	blendFunc GL_DST_COLOR GL_ZERO
	}
}
Link to comment
  • 2 weeks later...

For discrete transparency you should really be using the alphafunc GE128 (or LT 128) command.

If for somereason you really need gradual transparency youll need a depthfunc equal in the lightmap stage.

 

Oh, and dont forget to ad the "lightmapped" spawnflag to the model in radiant.,

Link to comment

For discrete transparency you should really be using the alphafunc GE128 (or LT 128) command.

If for somereason you really need gradual transparency youll need a depthfunc equal in the lightmap stage.

 

Oh, and dont forget to ad the "lightmapped" spawnflag to the model in radiant.,

 

Hmm yeah I had already tried the GE128 + the depthfunc equal option I'm afraid, and it gives me all-or-nothing transparency. It looks good from a distance, but loses some credibility up close compared to what I had in the previous shader (although very buggy and unusable). I replaced blendFunc with the alphaFunc, otherwise it had no effect.

 

Wasn't aware of the lightmap ("lighted") spawnflag! Thanks.

 

I can't quite realize the difference between blendfunc and alphafunc and their roles in each others' lives. Further suggestions appreciated!

Link to comment
textures/blueice_nightfall/nightfall_treebranch
{
    qer_editorimage    textures/blueice_nightfall/nightfall_treebranch
    qer_trans 1.0
    q3map_onlyvertexlighting
    surfaceparm    nonopaque
    surfaceparm    trans
    surfaceparm nonsolid
    cull twosided
    {
        map textures/blueice_nightfall/nightfall_treebranch
        alphaFunc GE128
        depthWrite
        rgbGen vertex
    }
}

Thats the nightfall shader -> worked pretty well to be fair. It uses vertex lighting to save on compile time but still looks fine.

For a tree branch, do you not want all or nothing transparency? Its not like some bits of twigs are partially transparent are they? For gradual transparency with lightmaps, particularly used for already partially transparent surfaces + additional alpha blending, the "depthfunc equal" seems to be the magic parameter, otherwise you get the lightmap showing up and ruining the gradual blend even if the texture itself has successfully faded away )  

 

AFAIK, Alphafunc describes how to use the alpha channel by the renderer, and blendfunc describes how various texture layers are mixed with each other. Theres a lot of duplicate commands too, for example blendfunc GL_ONE GL_ONE is identical to blendfunc add, and blendfunc GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA I think is the same as blendfunc blend.

 

EDIT:

Heres the documentation in the shader manual:

 

http://q3map2.everyonelookbusy.net/shader_manual/ch6.htm

 

ALSO - Use cull twosided

Link to comment
textures/blueice_nightfall/nightfall_treebranch
{
    qer_editorimage    textures/blueice_nightfall/nightfall_treebranch
    qer_trans 1.0
    q3map_onlyvertexlighting
    surfaceparm    nonopaque
    surfaceparm    trans
    surfaceparm nonsolid
    cull twosided
    {
        map textures/blueice_nightfall/nightfall_treebranch
        alphaFunc GE128
        depthWrite
        rgbGen vertex
    }
}

Thats the nightfall shader -> worked pretty well to be fair. It uses vertex lighting to save on compile time but still looks fine.

For a tree branch, do you not want all or nothing transparency? Its not like some bits of twigs are partially transparent are they? For gradual transparency with lightmaps, particularly used for already partially transparent surfaces + additional alpha blending, the "depthfunc equal" seems to be the magic parameter, otherwise you get the lightmap showing up and ruining the gradual blend even if the texture itself has successfully faded away )  

 

AFAIK, Alphafunc describes how to use the alpha channel by the renderer, and blendfunc describes how various texture layers are mixed with each other. Theres a lot of duplicate commands too, for example blendfunc GL_ONE GL_ONE is identical to blendfunc add, and blendfunc GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA I think is the same as blendfunc blend.

 

EDIT:

Heres the documentation in the shader manual:

 

http://q3map2.everyonelookbusy.net/shader_manual/ch6.htm

 

ALSO - Use cull twosided

 

 

If you compare this one @ all-or-nothing transparency with this one @ gradual trasparency, you probably see what I mean. Hard vs soft edges. I'm trying to replicate how it looks in 3DS max as closely as possible.

 

The current shader is thus:

 

 

 

models/map_objects/bootland/trees/pinestem4
{
	cull disable
	surfaceparm noimpact
	surfaceparm nomarks
	surfaceparm nonsolid
	{
	map models/map_objects/bootland/trees/pinestem4.tga
	alphafunc GE128
	}
	{
	map $lightmap
	rgbGen identity
	blendFunc GL_DST_COLOR GL_ZERO
	depthfunc equal
	}
}

 

 

 

Actually now that I think about it, I recall failing to implement gradual transparency with lightmapped shaders, in a previous thread. Surprised I didn't realize that before. You answered that one actually! If it's still undoable in 2014, it's fine the way it is though (although it seems almost that only a bug is holding it back..)

 

By the way, you said to use twosided. Does it differ from cull disabled, which I had?

Link to comment

It just looks like the alpha channel isnt very good to me. No, actually, I dont think twosided is any different from none. Have you tried adding "depthWrite" to your main texture stage?
 
You can have lightmapped gradual transparency, you just need the right lightmap stage as mentioned in last post using depthfunc equal - Ive recently used it for lightmapped alpha faded water in the Bioshock map. DOnt know about how it works with a alpha blend in the texture itself....

models/map_objects/bootland/trees/pinestem4
{
    cull disable
    surfaceparm noimpact
    surfaceparm nomarks
    surfaceparm nonsolid
    q3map_alphashadow
    {
    map models/map_objects/bootland/trees/pinestem4.tga
    alphafunc GE128
    depthWrite
    }
    {
    map $lightmap
    rgbGen identity
    blendFunc filter
    depthfunc equal
    }
}

Or, perhaps for gradual...:

models/map_objects/bootland/trees/pinestem4
{
    cull disable
    surfaceparm noimpact
    surfaceparm nomarks
    surfaceparm nonsolid
    q3map_alphashadow
    {
    map models/map_objects/bootland/trees/pinestem4.tga
    blendFunc blend
    depthWrite
    }
    {
    map $lightmap
    rgbGen identity
    blendFunc filter
    depthfunc equal
   }
}
Link to comment

Your first shader works for non-gradual transparency (looks the same way as before), but the second one leaks. I remember I tried some things that caused that before I posted here, but yes it gives gradual transparency, although it leaks. The blendfunc blend causes it.

 

leakPine.jpg

 

The branch texture is WIP/placeholder but it's not too far away from what I want. The alpha channel seems fine though.

Link to comment

Well I couldnt get it to work with a full lightmap, but with onlyvertex lighting it works just as well

 

 

textures/blueice_nightfall/nightfall_treebranch
{
    qer_editorimage    textures/blueice_nightfall/nightfall_treebranch
    qer_trans 1.0
    q3map_onlyvertexlighting
    surfaceparm    nonopaque
    surfaceparm    trans
    surfaceparm nonsolid
    cull twosided
    {
        map textures/blueice_nightfall/nightfall_treebranch
        blendfunc blend
        rgbGen vertex
    }
}

 

#01 Vertex Lit with blendfunc blend

kW3QS7Jl.jpg

 

#02 Lightmapped with alphafunc GE128

9Hb4I3Dl.jpg

Link to comment

Hmm. That leads me right back to this problem again. Collides with itself + other shaders.

 

Current shader:

models/map_objects/bootland/trees/pinestem4
{
    cull disable
    surfaceparm noimpact
    surfaceparm nomarks
    surfaceparm nonsolid
    q3map_onlyvertexlighting
    {
    map models/map_objects/bootland/trees/pinestem4.tga
    blendFunc blend
    rgbGen vertex
    }
}
Link to comment
models/map_objects/bootland/trees/pinestem4
{
    q3map_alphashadow
    surfaceparm nonsolid
    surfaceparm    nonopaque
    surfaceparm    trans
    cull twosided
    {
        map models/map_objects/bootland/trees/pinestem4
        alphafunc GE128
        rgbgen vertex
    }
    {
        map models/map_objects/bootland/trees/pinestem5
        blendfunc blend
        rgbgen vertex
    }
}

I got around it by using 2 opacity stages. The first (GE128) gives you the blocking effect and transparency, and then the overlaying blendfunc gives you the smoothed edges. You'll need 2 separate alpha images, I made the pinestem5 alpha slightly larger and the pinestem4 (for the GE128) slightly smaller using darkness tool in photoshop. This IS 2 rendering passes though so for a lot of trees will take a performance hit, presumably. You can adjust the alpha at your own discrepancy

 

NB: I also made it blocksize 0, removed the lightgrid worldspawn key added basic lighting. (And changed water for effect :P)

 

CvOwkRDl.jpg

RFzYKzBl.jpg

zy9ALiHl.jpg

Boothand likes this
Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...