add new feature to blender

hi, i’ve been looking around the blender code and I would like to add/change something. where it currently has for osa setting buttons (5,8,11,16) I would like to place a number button. By looking at other number buttons I’ve been able to add the button that has a min of 0 and a max of 16, but when I leave the buttons window after I compile, it changes back to zero. There was a warning during the compile about &G.scene->r.osa not being compatible with the defbuttonf function (I think it’s defbuttonf). What is necessary to make this work? thank you (if this is in the wrong forum I’ll repost on the appropiate one)

I suggest you join the #blendercoders channel on IRC and ask there.

Mike

Why would you want to put a number button in the OSA panel anyway, for most members here the 4 buttons already there are enough.

Also, IIRC, the jitter tables are optimized with the available level of OSA, adding a numbut would mean creating optimized tables for all the missing values.

Martin

Theeth is right, check here: http://mediawiki.blender.org/index.php/Manual/Oversampling_(Antialiasing)

Because of this it’s possible that an OSA value of, say 14, might look worse than 11.

maybe most people don’t care enough about their aliasing issues…
some people even seem to enjoy grainy renders because of the pseudo photo look…

i’ve been also looking for more samples options in the OSA department and also for the number of AO samples so that we could bake hi quality maps…

with hi-frequency geometry or complex textured details, it is hard to get really clean renders without banding, moiré patterns or jaggies…
in other renderers, it is not uncommon to crank up sub-rays to 32, 64 or even 128 to get a desired crisp and clean picture…
with blender internal, i render at double-size and then filter+resize in post… not very handy for animation…

what i really wish is some kind of adaptive filtering : setup ‘min’ and ‘max’ samples plus a ‘quality threshold’ or ‘rate’ which evaluates the returned values to determine if more samples are needed…
a bit like the refine shadows option for irradiance caching in yafray…

okay, I’m home now so I can look at what I actually have, I commented the normal buttons for osa, and added this line:

 
uiDefButF(block, NUM,B_DIFF, "OSA:",        369,88,122,20, &G.scene->r.osa, 0.0, 16.0, 0, 0, "sets osa(test)");

this results in a number button (like the XParts and YParts buttons) under the OSA button that has a min of 0 and a max of 16.0. I don’t really care that having numbers in between doesn’t acomplish much, I’m just experimenting and I saw this feature in an old venomGFX build I have (he had the percent buttons as a number button also [from 1 to 1000]). I’m guessing that it has something to do with the way r.osa is declared, but I can’t find where it’s declared.

I didn’t know that thing that matt said… I added that OSA slider in my patch just for using values of 2 and 3 in OSA, because it gives you antialising and speed, faster than 5 and antialised textures, very useful!
however…I don’t use that slider too much, just took off the “11” button and made the four buttons with values of “2”, “5”, “8” and “16”, as shown in the image

the slider in Size is really useful when using “border” option, if your border selection is small and you want to see that bigger, you have to re-set the Size in pixels… bit annoying. I saw this slider time ago in Tuhopuu, but it was up to 100% I think, don’t remember…

Id be interested in seeing a case where values higher then 16 made a usefull difference, could do some tests comparing 16 with larger renders scaled back down if you didnt want to add in jitter tables for 32 :wink:

Ark! That patch rocks ! Osa 2 is so much cleaner than none and fast ta boot!

thank you venomgfx! by looking at your patch I was able to glean enough information to replace the buttons with a slider, and replace the 100% button with a min and max percent button and the 75, 50 and 25% buttons with the actual percent slider, will post a picture in a minute.

http://i146.photobucket.com/albums/r242/dreblen/buttons.png
here is my setup!

hehe cool =)

I think I still miss those 100, 75, 50 and 25% buttons, I prefer a click than entering a name or moving an slider each time you want a quarter, half, or entire image to render.

btw, anyone still uses Mblur?

I do. Low mblur + vector blur gives superior results to either one on its own.

O yeah… mblur at 16 samples (and no osa) gives the best result when doing something really tiny, like a 10 by 10 pixel render for a web icon. Don’t ask me for a technical explanation, it just does. hehe

okay, I am just experimenting now, I have created my own panel called ‘osa’, I have the osa buttons and I want to have a TOG button that, when active, enables my osa slider, but as hard as I tried, I couldn’t get it to work (help on TOG buttons would be nice), so I am trying to have two ROW buttons, one called ‘Y’, and the other called ‘N’, when Y is active, the slider is there, when N is active, it’s not there, this is my code:

static void render_panel_test(void)
{
    uiBlock *block;
    short int slider;
    
    block= uiNewBlock(&curarea->uiblocks, "render_panel_test", UI_EMBOSS, UI_HELV, curarea->win);
    if(uiNewPanel(curarea, block, "Oversampling (Anti-Aliasing)", "Render", 1280, 0, 318, 204)==0) return;
    
    uiBlockBeginAlign(block);
    //uiDefBut(block, LABEL, 0, "Test osa settings",150,175,70,20, 0, 1.0, 0,0,0,"");
    uiDefButBitI(block, TOG, R_OSA, B_DIFF, "OSA", 369,109,122,20,&G.scene->r.mode, 0, 0, 0, 0, "Enables Oversampling (Anti-aliasing)");
    uiDefButS(block, ROW,B_DIFF,"2",   369,88,29,20,&G.scene->r.osa,2.0,2.0, 0, 0, "Sets oversample level to 2");
 uiDefButS(block, ROW,B_DIFF,"8",   400,88,29,20,&G.scene->r.osa,2.0,8.0, 0, 0, "Sets oversample level to 8 (Recommended)");
 uiDefButS(block, ROW,B_DIFF,"16",   431,88,29,20,&G.scene->r.osa,2.0,16.0, 0, 0, "Sets oversample level to 16");
 uiDefButS(block, ROW,B_DIFF,"32",   462,88,29,20,&G.scene->r.osa,2.0,32.0, 0, 0, "Sets oversample level to 32");
    uiBlockEndAlign(block);
    
    uiBlockBeginAlign(block);
    
    uiDefButS(block, ROW,slider,"Y",     369,48,61,20,&slider,1.0,1.0,0,0,"Enables the osa slider");
    uiDefButS(block, ROW,slider,"N",     430,48,61,20,&slider,2.0,0.0,0,0,"Disables the osa slider");
    if(slider==1)
    {
    uiDefButS(block, NUM,B_REDR,"",      369,68,122,20,&G.scene->r.osa,2.0,32.0,0,0,  "Slider to set oversample level");
    }
    uiBlockEndAlign(block);
    
}

help would be apreciated…

I totally agree with the OP, blender needs a 2X AA mode for preview, and a 32x mode for high quality productions.

And yes, m-blur + vector blur still gives much more physically accurate result than just vector blur.

Hi,

Two versions of code presented below.

  1. Slider shown whenever OSA is turned on
  2. Slider show only when user turns on the toggle.

static void render_panel_test(void)
{
    uiBlock *block;
 
    block= uiNewBlock(&curarea->uiblocks, "render_panel_test", UI_EMBOSS, UI_HELV, curarea->win);
    if(uiNewPanel(curarea, block, "Oversampling (Anti-Aliasing)", "Render", 1280, 0, 318, 204)==0) return;
    
    uiBlockBeginAlign(block);
    uiDefButBitI(block, TOG, R_OSA, B_DIFF, "OSA", 369,109,122,20,&G.scene->r.mode, 0, 0, 0, 0, "Enables Oversampling (Anti-aliasing)");
    uiDefButS(block, ROW,B_DIFF,"2",   369,88,29,20,&G.scene->r.osa,2.0,2.0, 0, 0, "Sets oversample level to 2");
    uiDefButS(block, ROW,B_DIFF,"8",   400,88,29,20,&G.scene->r.osa,2.0,8.0, 0, 0, "Sets oversample level to 8 (Recommended)");
    uiDefButS(block, ROW,B_DIFF,"16",   431,88,29,20,&G.scene->r.osa,2.0,16.0, 0, 0, "Sets oversample level to 16");
    uiDefButS(block, ROW,B_DIFF,"32",   462,88,29,20,&G.scene->r.osa,2.0,32.0, 0, 0, "Sets oversample level to 32");
    uiBlockEndAlign(block);
    
    uiBlockBeginAlign(block);
    if (G.scene->r.mode & R_OSA)        
         uiDefButS(block, NUM,B_REDR,"",      369,68,122,20,&G.scene->r.osa,2,32,0,0,  "Slider to set oversample level");
    uiBlockEndAlign(block);
    
}


static void render_panel_test(void)
{
    uiBlock *block;
    short show_slider= 0;
 
    block= uiNewBlock(&curarea->uiblocks, "render_panel_test", UI_EMBOSS, UI_HELV, curarea->win);
    if(uiNewPanel(curarea, block, "Oversampling (Anti-Aliasing)", "Render", 1280, 0, 318, 204)==0) return;
    
    uiBlockBeginAlign(block);
    uiDefButBitI(block, TOG, R_OSA, B_DIFF, "OSA", 369,109,122,20,&G.scene->r.mode, 0, 0, 0, 0, "Enables Oversampling (Anti-aliasing)");
    uiDefButS(block, ROW,B_DIFF,"2",   369,88,29,20,&G.scene->r.osa,2.0,2.0, 0, 0, "Sets oversample level to 2");
    uiDefButS(block, ROW,B_DIFF,"8",   400,88,29,20,&G.scene->r.osa,2.0,8.0, 0, 0, "Sets oversample level to 8 (Recommended)");
    uiDefButS(block, ROW,B_DIFF,"16",   431,88,29,20,&G.scene->r.osa,2.0,16.0, 0, 0, "Sets oversample level to 16");
    uiDefButS(block, ROW,B_DIFF,"32",   462,88,29,20,&G.scene->r.osa,2.0,32.0, 0, 0, "Sets oversample level to 32");
    uiBlockEndAlign(block);
    
    uiBlockBeginAlign(block);
    uiDefButBitS(block, TOG, 1, B_REDR, "OSA", 369,90,122,20,&show_slider, 0, 0, 0, 0, "Show slider to set oversample level");

    if (show_slider)        
         uiDefButS(block, NUM,B_REDR,"",      369,68,122,20,&G.scene->r.osa,2,32,0,0,  "Slider to set oversample level");
    uiBlockEndAlign(block);
    
}

Aligorith

sadly, these are the same tests that I did, and they don’t work.