Welcome, Guest. Please login or register.
June 19, 2013, 06:37:23 pm

Login with username, password and session length
Members
Total Members: 488
Latest: Wimmie
Stats
Total Posts: 7309
Total Topics: 1178
Online Today: 6
Online Ever: 229
(April 05, 2011, 09:10:50 am)
Users Online
Users: 0
Guests: 2
Total: 2
Permissions

A Squeakyduck Design product
Pages: [1] 2 3
Print
Author Topic: Outlining/Cel shading solution for the 3d module?  (Read 6807 times)
justluke
Cobra Owner
Jr. Member
*
Offline Offline

Posts: 109


« on: January 19, 2007, 05:28:20 pm »

Graham, I know that it's premature to ask questions about the 3d module seeing as you've no doubt got enough on your hands with the initial Cobra release (congratulations by the way), but:

Will the 3d module feature the ability to cel shade and outline animated models? Speaking personally, the latter (the outlines) is more important than the former - I know the old manually "duplicate a model, expand the vertices, paint it black and flip the normals" technique for getting outlines, but it looks ugly and the line width isn't uniform. Ideally, what I'd like to see is the ability to generate nice, clean uniform outlines within the engine (via shaders?)

I'd literally buy cobra and the 3d module just for the above features if they were supported - not that I expect the prospect of one measly sale to tempt you into implementing them, of course.
Logged
GrahamK
Administrator
Hero Member
*****
Offline Offline

Posts: 2031


Cobrabytes
« Reply #1 on: January 19, 2007, 06:45:31 pm »

You mean like these ?

Although these are static polygons, it works on animated stuff too. This version doesn't use shaders, just a feature of OpenGL called Texture Combiners. It can be done with shaders (faster) for modern cards.

(I'll post the code which does this over the weekend)
« Last Edit: January 19, 2007, 06:47:38 pm by GrahamK » Logged
justluke
Cobra Owner
Jr. Member
*
Offline Offline

Posts: 109


« Reply #2 on: January 19, 2007, 07:00:00 pm »

That seems to fit the bill quite nicely, but does it cope as well with complex animated models as it does with primitives? For example, could I load in a complex, animated .b3d model (or one of the equivalent model formats that Cobra supports) and consistently get just as decent results?
« Last Edit: January 19, 2007, 07:04:16 pm by justluke » Logged
GrahamK
Administrator
Hero Member
*****
Offline Offline

Posts: 2031


Cobrabytes
« Reply #3 on: January 19, 2007, 07:02:21 pm »

Yep, I'll try and do an anim of an animated soldier I have.

It's applied at texture level, so works with anything (but it's not just an outline on a texture, if you see what I mean).
Logged
justluke
Cobra Owner
Jr. Member
*
Offline Offline

Posts: 109


« Reply #4 on: January 19, 2007, 07:03:38 pm »

Thanks, I'd appreciate that.
Logged
Filax
Cobra Owner
Jr. Member
*
Offline Offline

Posts: 70


« Reply #5 on: January 19, 2007, 09:32:17 pm »

Just for information ? is there a web page with he 3D engine features ? Smiley
Logged
GrahamK
Administrator
Hero Member
*****
Offline Offline

Posts: 2031


Cobrabytes
« Reply #6 on: January 19, 2007, 09:34:54 pm »

There was on the older sites, I'm hoping to start building up the info on Cobra 3D starting this weekend, so there will be pages linked to it.

My main focus over the last few weeks has been to stick to the release, but I can start to get other things done now.
Logged
dib
Newbie
*
Offline Offline

Posts: 37


« Reply #7 on: January 19, 2007, 10:23:42 pm »

justluke


I also wait cartoon SHADER in cobra 3D
and already I made this same question but it seems that it is in old f?rum.

GrahamK said me that all the parameters(paint levels and colors,outlines color and thickness) will be controlled by the texture


also exists the outline SHADER (I also wait this shader),that is better and different than the outline controlled by texture.

« Last Edit: January 19, 2007, 10:29:44 pm by dib » Logged
Steve
Cobra Owner (Pro)
Full Member
*
Offline Offline

Posts: 553



« Reply #8 on: January 20, 2007, 08:50:28 am »

Yes good idea to get some 3d screenshots and list of features on the site, because some people still don't get it.  Being able to use pure2d is great for compatibility and pixel plotting (but that's no where near as fast as hardware acceleration.)  A full built-in 3d engine is far more impressive to potential customers (as long as you make it clear it won't be included in the current version).
« Last Edit: January 20, 2007, 08:55:18 am by Steve » Logged

PC: Intel Core Duo, 2.53 Ghz, 3Gb RAM, Intel G45 Express, Windows Vista Home Premium

Notebook: Samsung NC10, Intel Atom N270, 1.60Ghz, 2Gb RAM, Mobile Intel 945 Express, WindowsXP Home Edition.
justluke
Cobra Owner
Jr. Member
*
Offline Offline

Posts: 109


« Reply #9 on: January 20, 2007, 07:46:42 pm »

Getting back on topic...

Dib's post is interesting.

I'd like to hear more about the cartoon and outline shaders. For example, more about the parameters that Dib mentioned, how flexible the shaders are, how well the cartoon shader reacts to light sources, and perhaps a code snippet or some pseudo code to show how these might work?

I hope it's not too cheeky to keep pestering for detailed information about the eatures of an unreleased module.
Logged
dib
Newbie
*
Offline Offline

Posts: 37


« Reply #10 on: January 21, 2007, 06:37:48 am »

justluke

independently of being or not one future feature...

in these links you will find explanations about the cartoon shader texture and the outline shader.

http://www.gamedev.net/reference/programming/features/celshading/
http://www.gamedev.net/reference/programming/features/cartoon/
Logged
justluke
Cobra Owner
Jr. Member
*
Offline Offline

Posts: 109


« Reply #11 on: January 21, 2007, 09:41:02 am »

Yes, Dib, I know that. What I want to know is how they specifically work in Cobra; how they are implemented.
Logged
GrahamK
Administrator
Hero Member
*****
Offline Offline

Posts: 2031


Cobrabytes
« Reply #12 on: January 21, 2007, 09:05:10 pm »

I've posted a demo video in the downloads section, to show off a little of the cel shading.

Code that was running was :
Code:
program
uses cobra3d,keyset

var
  camera,obj,light:element
  piv,piv2:element
  mat : element
  ca,la:integer = 0
  capture : boolean
  shader:element
begin

  {create a new screen}
  openscreen(640,480,32,false);
                               
  BGColor(0,200,100)
 
  {create main viewer camera}
  camera = createcamera;
  positionEntity(camera,14,0,00);
  UseCamera(camera);
 
  {create a pivot for the light so we can spin it round a point}
  piv = createpivot;
  positionentity(piv,0,0,2);
  light = createlight(camera);
  EntitySetAttribute(light,'ConstAttenuation',0);

  positionentity(light,1,0,0);

  piv2 = createpivot;
  positionentity(piv2,0,0,0);   
 
  {Load actor}                   
  obj =loadactor('media\waste.md2',piv2);
  scaleentity(obj,0.4,0.4,0.4)
  setanimation(obj,'stand') 
  turnentity(obj,90,0,-60)

  entityattribute(obj,'AnimationMode',c3d_animloopf);

  // Load a texture for it (Replace one which is on there and allow us to add the shader)
  mat = CREATETEXTUREMATERIAL('media\wastecell.jpg')     
 
  // create the cel shader
  shader=createshader(c3d_shadercelshader)
  shaderattribute(shader,'outlinewidth',3)
  shaderattribute(shader,'outlinecol',torgba(0,0,0))
  ShaderAttribute(shader,'options','+o +t ')

  // use same shader on materials 
  matuseshader(mat,shader)

  // use the material on the model
  entityusematerial(obj,mat)
                                 
  // look at the model
  setcameratarget(camera,obj)

  { loop until escape is pressed}
  while not keydown(vk_escape)
       
    TurnEntity(obj,0,0,0.04)
 
    if keydown(vk_f10) then
      if ca = la then
        inc(ca)
        if ca>=animationcount(obj) then ca = 0
        setanimation(obj,animationname(obj,ca),true)
      endif
    else
      la = ca
    endif

    {redisplay the screen}
    flip;           
                           
       // if capturing avi, capture a frame here
       if capture=true then
          freeze
          avicapture
          unfreeze
       endif                   
       
       // start avi capture
       if keydown(vk_f1) then
         if capture=false then
            freeze
            avistart('celsoldier.avi',640,480,60,1)
            unfreeze
            capture=true
         endif
       endif

       // stop aVI capture
       if keydown(vk_f2) and capture=true then
          avistop
          capture = false
       endif
     

  wend;

  {close the screen after use, (will free all entities  automatically) }
  closescreen;

end.

Logged
Steve
Cobra Owner (Pro)
Full Member
*
Offline Offline

Posts: 553



« Reply #13 on: January 21, 2007, 09:34:48 pm »

Cool!  Smiley
Logged

PC: Intel Core Duo, 2.53 Ghz, 3Gb RAM, Intel G45 Express, Windows Vista Home Premium

Notebook: Samsung NC10, Intel Atom N270, 1.60Ghz, 2Gb RAM, Mobile Intel 945 Express, WindowsXP Home Edition.
stef
Cobra Owner
Jr. Member
*
Offline Offline

Posts: 113


« Reply #14 on: January 21, 2007, 10:15:06 pm »

Quote
Cool! 

Wished I could say the same!

But can't dowlnload the video.
Quote
Sorry, your account does not have access to downloads.
« Last Edit: January 21, 2007, 10:23:55 pm by stef » Logged
Pages: [1] 2 3
Print
Jump to: