Not logged in, Join Here! or Log In Below:  
 
News Articles Search    
 


Submitted by Chris Miller, posted on April 25, 2002




Image Description, by Chris Miller



This is a screen grab of my latest coding demo, WebGL. Not your typical OpenGL demo, it combines OpenGL with Dynamic HTML, ASP, and CGI to show interactive 3d modeling in a browser window. You draw in the edit window, then click "Render Changes" to update the 3d display. The scene is rendered by OpenGL into an offscreen buffer. Then it is sent to stdout for display by the browser. I'm not sure if it works on every version of every browser, but i've tested it with IE 5.5 and Navigator 4.04.

Have a look at: http://www.cosmicbee.com/webgl.asp

I would love to see some critique, and hopefully squash a few bugs. Please excuse the rest of the site, as it is in development.

Here are some details...
  • Hand coded Dynamic HTML user interface. I used Dreamweaver to create page templates from my menu system.
  • C++ CGI application to render the scene with OpenGL. I'm using glReadPixels to grab the color buffer. This was interesting to write, because there is no user interface. The program simply outputs a JPG stream to stdout.
  • Uses the Intel JPG library to create the in-memory JPG stream.
  • Bilinear filtereing of the 3d image.
  • Parameter passing with POST to retain page state. The grid is encoded as hexdecimal strings which are passed to the CGI program via GET.
  • Possible enhancements...
  • Stack 15 of these 15 x 15 grids together to create a "cube" which is editable slice by slice.
  • Camera positioning
  • Custom positionable lights
  • Load and save of the grid using the browser.
  • Enlarged image rendering
  • And some bugs...
  • Floating palette doesn't drag on Netscape (working on it).
  • Chris Miller


    [prev]
    Image of the Day Gallery
    www.flipcode.com

    [next]

     
    Message Center / Reader Comments: ( To Participate in the Discussion, Join the Community )
     
    Archive Notice: This thread is old and no longer active. It is here for reference purposes. This thread was created on an older version of the flipcode forums, before the site closed in 2005. Please keep that in mind as you view this thread, as many of the topics and opinions may be outdated.
     
    MC BAXTON

    April 25, 2002, 03:44 PM

    Hey I promise I will not make fun of you for next 2 hours

    live in peace

     
    Milo

    April 25, 2002, 03:59 PM

    I think that it is fun however it is not completely a new idea.

    I have saw many server-side ASP components that generate graphics in back-end using OpenGL.
    For example:

    http://www.dundas.com/products/asp/PieChart/index.asp?screenshots.htm

    I think that you may have innovation on what content of images are useful (or FUN!) to be generated, and what kind of special interaction can be used as parameters.

     
    Mathieu 'PO' HENRI

    April 25, 2002, 04:10 PM

    why do you reload the whole page ??
    as a web-developer I must say it's piece of cake
    you noticed you used some C/C++ CGI , I'm not familiar with CGI but do you mean you did an APACHE plug-in ? ( a developer at my company is fond of coding APACHE plug-in in C/C++ :) )

     
    sSpyder

    April 25, 2002, 04:11 PM

    It works in Opera 6.0 for me so I don't know what ScrewLoose is talking about.

     
    ector

    April 25, 2002, 04:18 PM

    japanese and korean cell phones already have 3D acceleration (yes, it's true!)

     
    Chris Miller

    April 25, 2002, 04:23 PM

    You're right, I don't have to reload the whole page... Just something I haven't had time to fix yet. When you click Render, I can just reload the image. That would reduce my server side hit by a little.

    No, this isn't an apache plugin - just a standard c++ cgi application that sends its output to stdout. It is running on IIS today, but it is fairly portable code, so it would work on a unix box with few changes.

     
    FaceTake

    April 25, 2002, 04:23 PM

    Reminds me of a site where you a Doom map was rendered on the server and sent back to the browser as an image via a script.

     
    Hoyle

    April 25, 2002, 04:29 PM

    I have a house full of monitors, but not build out of monitors. . . . .

    I agree with Insight, To be truly creative you have to be willing to do something that's a bit different than everyone else.

    Kudo's to this IOTD for being just that . . . different!

     
    Impossible

    April 25, 2002, 04:32 PM

    I can't wait until MC Baxton posts an IOTD. No matter how good it is everyone should flame his ass.

     
    Hoyle

    April 25, 2002, 04:32 PM

    first problem with ActiveX is I would not have been able to view the web page under Linux. Also if you don't have a good 3D card it doesn't matter, a crappy client (and we know they are out there . . . not everyone is lucky enough to have GF3, man I'm glad I'm lucky) could view images.

    I could imagine a website that sells 3D Models and Textures, and you could use a simple app to preview, mix and match models, textures, etc . . . , and they never get downloaded so the client can't write some code to rip them off from the Vendor (just one idea . . .)

     
    Hoyle

    April 25, 2002, 04:33 PM

    Man I wish I lived in Japan!

     
    Neos33

    April 25, 2002, 04:40 PM

    great job

    why not have the preview in a floating frame? this way the whole page won't reload

     
    MC BAXTON

    April 25, 2002, 04:42 PM

    Hey all you lamers who blame meh... :)
    Why you dont like me losers
    just to tell the truth it's not to insult you :)

    I specially DO NOT wrap my truh inside. Simply because you all are fools ;p It's like the experiment with monkeys

    :)most of you are kids who would like to make games. Those can't understand many things :)
    Programming is MORE than just games.

    In fact, philosophy has an important role in making algorithms. People, who are limited are you :) Should it be sad ? Not. Its just facts

    I dont care what you say about meh because i feel like messiah and trying to show reality for you :) Your ability to accept truth is important and it is limited. Is this is sign of civilization ? :)

    My experiments will probably end after ~2 weeks. But I'll be back soon and that can continue for next 80 yrs ;p Hope this site will live enough :)))

    Advice for you: do not read this message :))))










     
    ScrewLoose

    April 25, 2002, 04:45 PM

    The initial screen loads but I cannot select anything from the palette or edit the picture. I have javascript and everything turned on. Are you possibly using 6.01???

     
    Brett Johnson

    April 25, 2002, 04:50 PM

    huh?

     
    Hoyle

    April 25, 2002, 04:53 PM

    Hey Baxton,

    Starting a "civilized" conversation by calling everyone a lamer probably isn't the best thing to do. That is just an honest suggestion.

    While it is okay to "not wrap the truth inside" it is sometimes considered socially acceptable to not tell the whole truth. Just because something is bad you don't have to say "that thing sucks and you are an idiot", instead you can try to offer a positive suggestion like "Here's an idea that may make that thing better". <- I hope that makes sense.

    While most of the "lamers" as you put it on this board might be kids, that means absolutely nothing. I started programming when I was 7 years old, and because I did I consider myself today (I'm 28) a very good programmer. No I didn't know everything when I was a kid, but I wasn't agraid to try or to mess up. Of course, I didn't have people calling me an idiot and calling my ideas stupid. Children should be encourged, not yelled out.

    Programming is more than just games, but so what? How do you know everyone is limited? Just because there quality of work doesn't match yours doesn't mean they are limited. They are trying, and that counts for more than anything! I'd rather see an IOTD posted by a "lamer" who is an "idiot" and whose work is "crap" (note - I'm not saying this is true about todays posting) than to not see an IOTD.

    As to your experiments, please tell us a bit about what you are working on.

    haha ha - probably needed to put the advice about not reading the message in the subject line.

     
    Alex J. Champandard

    April 25, 2002, 04:54 PM

    From the site "anti-aliased using bilinear filtering".

    I can see the image is anti-aliased nicely, but I seriously doubt that bilinear filtering gets that effect! Don't you mean some other sort of filter?



    Let's all play a game, and ignore silly posts, ok?

    <wispers> ** what silly posts **

    That's the spirit!

     
    Gareth

    April 25, 2002, 04:57 PM

    Chris,

    Typically 3d modelling packages ( Max and Maya for example ) have two lights, one to the right of the scene, one kinda attached to the top left point of the near clipping plane.

    Play around with a few options, you shouldn't need more than two lights.

    And I really like this, more for the idea of streaming jpg data to the webpage than the rest, but to each his own :)

     
    Chris Miller

    April 25, 2002, 05:06 PM

    Yes, i'm pretty sure I mean bilinear filtered. :) The app renders the image at 2x resolution, then the image is scaled down - or subsampled in both the x and y directions.

     
    Alex J. Champandard

    April 25, 2002, 05:14 PM

    Hmmm, ok. I thought that's what you were doing, and I still don't call that bilinear filtering.

    For me, it's the art of linearly interpolating in U/V space between known discrete colour values of the texture (texels) to determine an approximation for any intermediary point in continuous texture space.

    You're doing mip-mapping, down sampling by averaging 4 pixels.

    Anyway, doesn't matter. It looks good.

     
    Mathieu 'PO' HENRI

    April 25, 2002, 05:22 PM

    thanks for your precisions.
    OK, I didn't knew at which stage were your application

    refreshing only the 3D preview image wouldn't only reduce a little the server hit but it would also increase the usability of the editor by removing the "annoying" delay due to refreshes

    keep up the good job

     
    Chris Miller

    April 25, 2002, 05:23 PM

    I don't see the difference - this is bilinear filtering. In this case, your U/V is really my X/Y, and my pixels are your textels. I'm averaging 4 pixels to make one. And what i'm doing really has nothing to do with mip-mapping...

     
    Steven Wittens

    April 25, 2002, 05:30 PM

    Well, usually bilinear filtering is used to get a colour value that lies between 4 texels to prevent ugly point sampling. And usually, all the surrounding sub-texels are drawn next to it. The idea is to make a larger image of a smaller one.

    Supersampling is the technique of rendering multiple samples for one pixel, and averaging them to achieve a better/smooth/realistic result. A common use is in raytracing: you bounce multiple 'jittered' rays of a reflective surface instead of one, and blend them to simulate soft reflections. The idea is to make a smaller image of a larger one.

    However, when you're supersampling with 4 samples in a square arrangement, you could consider this bilinear filtering, because you're retrieving the sub-texel that lies exactly in the middle of them.

    I'd still call it supersampling though.

    (note, I might have gotten some of the terminology wrong, I'm not an expert :) )

     
    Alex J. Champandard

    April 25, 2002, 05:36 PM

    There's a big difference conceptually -- in fact, it's the exact opposite, mapping too many texels on to a pixel (in GL that's TEXTURE_MIN_FILTER), or mapping too many pixels onto too few pixels (in GL this is TEXTURE_MAG_FILTER).

    The maths are quite similar in this case (4 texels, summing, 4 weights), but it's a coincidence. If you were to reduce the size four times, you'd be loading 16 pixels and averaging all of them. Would you agree that's no longer bilinear filtering in this case?

     
    Chris Miller

    April 25, 2002, 05:38 PM

    I like the sound of that. I think you are correct that this could be called supersampling rather than subsampling. Let's call it a bilinear something... Maybe filtering was the incorrect term - now that I think about it.

    Bilinear Interpolation... That's better.

     
    Svn Hek

    April 25, 2002, 05:45 PM

    This is tres cool! How about extending this and instead of a JPEG image, to generate a video stream (mpeg, whatever)? You can for example use this so that someone can preview your game without actually having the hardware to play it.

    OT:
    It's high time someone bitch-slapped that blabbering imbecile MC BAXTON into oblivion.

     
    CGameProgrammer

    April 25, 2002, 06:40 PM

    No, we should all write them in fragmented Martian English in such a way that you have to read it 3 times to figure out what we're trying to say.

    Nothing MC Baxton ever says alludes to any programming knowledge, but it is perfectly plausible that he's smarter than this (and a native English speaker even) and is simply role-playing as a troll, shall we say. Some people get their kicks from that sort of thing.

    Anyway Baxton has such a reputation here that his comments don't hurt.

     
    CGameProgrammer

    April 25, 2002, 06:47 PM

    You just registered today it appears, and your e-mail address is a joke.

     
    Zerwit

    April 25, 2002, 06:54 PM

    If you think you are the messiah, then you really need to lay off the LSD man.

     
    Svn Hek

    April 25, 2002, 07:17 PM

    I am Svn Hek of Ren and Stimpy fame :))

    It's a long story involving forgotten passwords - I used to lurk around as Oligopod. My account info has been updated with my e-mail, if you can't resist the urge to contact me.

     
    This thread contains 102 messages.
    First Previous ( To view more messages, select a page: 0 1 2 3 ... out of 3) Next Last
     
     
    Hosting by Solid Eight Studios, maker of PhotoTangler Collage Maker.