• Announcements

    • khawk

      Download the Game Design and Indie Game Marketing Freebook   07/19/17

      GameDev.net and CRC Press have teamed up to bring a free ebook of content curated from top titles published by CRC Press. The freebook, Practices of Game Design & Indie Game Marketing, includes chapters from The Art of Game Design: A Book of Lenses, A Practical Guide to Indie Game Marketing, and An Architectural Approach to Level Design. The GameDev.net FreeBook is relevant to game designers, developers, and those interested in learning more about the challenges in game development. We know game development can be a tough discipline and business, so we picked several chapters from CRC Press titles that we thought would be of interest to you, the GameDev.net audience, in your journey to design, develop, and market your next game. The free ebook is available through CRC Press by clicking here. The Curated Books The Art of Game Design: A Book of Lenses, Second Edition, by Jesse Schell Presents 100+ sets of questions, or different lenses, for viewing a game’s design, encompassing diverse fields such as psychology, architecture, music, film, software engineering, theme park design, mathematics, anthropology, and more. Written by one of the world's top game designers, this book describes the deepest and most fundamental principles of game design, demonstrating how tactics used in board, card, and athletic games also work in video games. It provides practical instruction on creating world-class games that will be played again and again. View it here. A Practical Guide to Indie Game Marketing, by Joel Dreskin Marketing is an essential but too frequently overlooked or minimized component of the release plan for indie games. A Practical Guide to Indie Game Marketing provides you with the tools needed to build visibility and sell your indie games. With special focus on those developers with small budgets and limited staff and resources, this book is packed with tangible recommendations and techniques that you can put to use immediately. As a seasoned professional of the indie game arena, author Joel Dreskin gives you insight into practical, real-world experiences of marketing numerous successful games and also provides stories of the failures. View it here. An Architectural Approach to Level Design This is one of the first books to integrate architectural and spatial design theory with the field of level design. The book presents architectural techniques and theories for level designers to use in their own work. It connects architecture and level design in different ways that address the practical elements of how designers construct space and the experiential elements of how and why humans interact with this space. Throughout the text, readers learn skills for spatial layout, evoking emotion through gamespaces, and creating better levels through architectural theory. View it here. Learn more and download the ebook by clicking here. Did you know? GameDev.net and CRC Press also recently teamed up to bring GDNet+ Members up to a 20% discount on all CRC Press books. Learn more about this and other benefits here.

Archived

This topic is now archived and is closed to further replies.

FXO

Modulating textures

12 posts in this topic

Hey there! You can combine two textures (on an two-textureunits-board)using "GL_MODULATE" or some other operator as argument to "glTexEnv". Now, how do u do this in two single passes? You could use blend to add textures, but modulate multiplies the colors.. Q3A allows you to turn off extensions (multitexture), and can still draw the lightmapped textures.. Thanks /Fredik Olsson
0

Share this post


Link to post
Share on other sites
Just draw the same triangle twice, once as the base texture and then once as the lightmap or such.
0

Share this post


Link to post
Share on other sites
Ok, but the is problem that I dont know how to combine the textures so that the lightmap modulates the underlying texture..?

EDIT: Wrote post too early (grammatical errors)...

Edited by - FXO on September 22, 2001 8:13:47 AM
0

Share this post


Link to post
Share on other sites
Basically, enable blending, set the texture mode to modulate (instead of replace), set the alpha (through glColor4f) to be translucent, then draw the lightmap poly over the other one.
0

Share this post


Link to post
Share on other sites
Now I use:

  
glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_COMBINE_EXT);
glTexEnvi(GL_TEXTURE_ENV, GL_COMBINE_RGB_EXT, GL_MODULATE);

glTexEnvf(GL_TEXTURE_ENV, GL_SOURCE0_RGB_EXT, GL_PREVIOUS_EXT);
glTexEnvf(GL_TEXTURE_ENV, GL_OPERAND0_RGB_EXT, GL_SRC_COLOR);

glTexEnvf(GL_TEXTURE_ENV, GL_SOURCE1_RGB_EXT, GL_TEXTURE);
glTexEnvf(GL_TEXTURE_ENV, GL_OPERAND1_RGB_EXT, GL_SRC_COLOR);


I draw the triangle two times using this method, but the second triangle replaces the first one, it doesn't modulate it.

Do you mean that I should enable blending using

  
glEnable(GL_BLEND);
glBlendFunc(GL_ONE, GL_ONE); // ?


Should I set the lightmaps alpha to zero?

Anyways, thanks for your time!


Edited by - FXO on September 22, 2001 8:41:37 AM
0

Share this post


Link to post
Share on other sites
You could try the blendfunc GL_DST_COLOUR,GL_ONE_MINUS_SRC_COLOUR tho that is only a guess at which one to use. Depending on the blendfunc used, you may not have to touch the alpha value with glColor4f
0

Share this post


Link to post
Share on other sites
I added this before the drawing of the second texture (code above):

  
glEnable(GL_BLEND);
glColor4f(1,1,1,0.5);
glBlendFunc(GL_DST_COLOR,GL_ONE_MINUS_SRC_COLOR);


The second texture still covers the first one.
However if i use glBlendFunc(GL_ONE,GL_ONE), the texture colors are added correctly, but I want to modulate them,....
0

Share this post


Link to post
Share on other sites
fxo your code is ok, no need for blending.
A/ can your card do the combine + multitexture extensions
B/ how do u draw the texture?
0

Share this post


Link to post
Share on other sites
zedzeek:

A/ yes, my card can do the combine + multitexture extensions

B/ Not really sure what you mean, but I draw the textured polygon twice when multitexturing is disabled (depthfunc:GL_LESS_EQUAL).

Found out how to do it - it was as you said Maximus, it had to do with the blendfunc operators, only it was:
glBlendFunc (GL_ZERO, GL_SRC_COLOR);

I don''t get it, I always thought that
operator1 + operator2 = result (ie. pixelcolor)

Does anybody know how it works or have any good places where I can read about how glBlendFunc() operators are used work?

Thanks for all the help!

0

Share this post


Link to post
Share on other sites
ok i read the ''Now I use:'' post , inreply to the original question + the latest.
to see how blending works check an app on my news page. also the multitexturing demo on my site will let u draw the quad either in one pass with multitexturing or 2 passes using blending check it out perhaps thats of interest.
0

Share this post


Link to post
Share on other sites
ok, I had some troubles connecting to your site, it is your "homepage" in your profile right?
0

Share this post


Link to post
Share on other sites
quote:
Original post by FXO
ok, I had some troubles connecting to your site, it is your "homepage" in your profile right?


yeah, i havent been able to add any new stuff to my site for ages, i think the recession has hit xoom. when i get some cash ill get me own site. could take a while
0

Share this post


Link to post
Share on other sites